[libcamera-devel] libcamera on Librem 5, phase detection auto focus

Pavel Machek pavel at ucw.cz
Tue Nov 22 00:46:29 CET 2022


Hi!

> > > So far I'm working with contrast detection, but samsung chip should
> > > support phase detection auto focus, too. So far I hacked
> > > drivers/media/i2c/s5k3l6xx.ko not to filter out those bits and took
> > > photos (and looked at them in darktable), but I don't see any obvious
> > > "defects" indicating presense of focus data. Do you have any pointers
> > > to more information by chance?
> > > 
> > > I took deliberately defocused photo to make "defects" easier to see. I
> > > guess I should take another one with less gain to keep other noise
> > > down. Any ideas how to locate those bits?
> > 
> > The PDAF pixels will be located at fixed positions in the pixel array,
> > documented by the sensor vendor. Some sensors will process the PDAF
> > pixels and provide the processed information in the CSI-2 embedded data.
> > I don't have access to the sensor datasheet, so I can't help much I'm
> > afraid :-(
> 
> Yep, I think I'm figuring it out with some help.
> 
> In case of L5, pixels are in the pixel array, and it is blue
> pixels. So... it is easy to take blurry 13M photo of barcode (with
> hacked driver, see above), remove red and green channels, enhance
> contrast... and pattern emerges. Pairs of pixels emerge, and they
> should be those AF pixels.
> 
> Now I guess I'll need to select two lines of special pixels, compute
> correlation between them, and adjust focus according to that.
> 
> Does not sound too bad...? But if someone already has code / tools to
> help, let me know.

Ok, so I'm pretty sure I have right pixels, I'll need to compute the
correlations, but it no longer looks as easy as it looked before.

Am I right that I should be able to do the AF using subset of special
pixels? I'm thinking about single horizontal line in the middle of screen...

I pushed work-in-progress code to
https://gitlab.com/tui/millipixels/-/merge_requests/new?merge_request%5Bsource_branch%5D=pdaf
.

Best regards,
								Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20221122/c189edca/attachment.sig>


More information about the libcamera-devel mailing list