Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/6by9/lens_shading

Lens shading analysis tool
https://github.com/6by9/lens_shading

Last synced: 3 months ago
JSON representation

Lens shading analysis tool

Awesome Lists containing this project

README

        

This app takes a raw or JPEG+raw file created on a Pi and analyses it to create a lens shading table.

The image should be of a well illuminated uniform scene (eg plain white sheet of paper or wall),
as it does a simple comparison of values at the appropriate points to make up a compensation table.

It'll write out the four colour channels as ch1.bin-ch4.bin, viewable as
16bit/pixel single channel images, although only the bottom 10 bits are used.
It also writes a file called ls_table.h, which provides the lens shading grid.
Pass that back to the camera component using code similar to:
```
{
MMAL_PARAMETER_LENS_SHADING_T ls = {{MMAL_PARAMETER_LENS_SHADING_OVERRIDE, sizeof(MMAL_PARAMETER_LENS_SHADING_T)}};
void *grid;
#include "ls_grid.h"
ls.enabled = MMAL_TRUE;
ls.grid_cell_size = 64;
ls.grid_width = ls.grid_stride = grid_width;
ls.grid_height = grid_height;
ls.ref_transform = ref_transform;
state->lens_shading = vcsm_malloc(ls.grid_stride*ls.grid_height*4, "ls_grid");
ls.mem_handle_table = vcsm_vc_hdl_from_hdl(state->lens_shading);
grid = vcsm_lock(state->lens_shading);
memcpy(grid, ls_grid, vcos_min(sizeof(ls_grid), ls.grid_stride*ls.grid_height*4));
vcsm_unlock_hdl(state->lens_shading);
status = mmal_port_parameter_set(camera->control, &ls.hdr);
if (status != MMAL_SUCCESS)
vcos_log_error("Failed to set lens shading parameters - %d", status);
}
```
and
```
vcsm_free(state.lens_shading);
```
when finished.