Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/6by9/lens_shading
Lens shading analysis tool
https://github.com/6by9/lens_shading
Last synced: 16 days ago
JSON representation
Lens shading analysis tool
- Host: GitHub
- URL: https://github.com/6by9/lens_shading
- Owner: 6by9
- Created: 2017-08-10T11:25:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-06-25T16:08:14.000Z (over 3 years ago)
- Last Synced: 2024-11-16T05:32:01.897Z (about 1 month ago)
- Language: C
- Size: 5.86 KB
- Stars: 19
- Watchers: 8
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-ISP - C
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.