-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interference between calibration and hflip vflip #11
Comments
I think of course that has some things to do with the bayer pattern. |
Yes, that was it. For V1 the script only works if hflip and vflip = True. For other values it is necessary to reorient the table as in the cpixip project. I will study now how it works for the V2 |
Hi @dgalland thanks for posting this - you are indeed correct, I'm afraid as I don't tend to use the v1 camera, and haven't touched the flip settings on my v2, that I never added support for flipped images. I think there are fields in the underlying MMAL structure that loads in the lens shading table that tell the firmware whether the lens shading table is intended for flipped or non-flipped images, but I must confess I've not yet figured out which way round they are supposed to go, and so they are probably just set to whatever the v2 camera does by default. Lastly, there are probably two issues - firstly the obvious one (the correction image being flipped) and secondly a slight shift of up to 64 pixels that results from the way the lens shading table is upscaled on the camera. Flipping the image with numpy as you're doing will fix the first one, it may or may not fix the second one - but if it's working for you, I wouldn't worry about it; it would be a subtle issue at worst! If you fancied figuring out the flipping parameters buried within my fork of picamera, I'd be very happy - but no worries if your workaround above is sufficent that you are happy leaving things as-is. All the best, Richard |
Hello, I initially did my correction using raw values, but switched to the closed loop version when I couldn’t get it to work properly. It turned out the issue was black point, because the black point on the v2 camera module is 64 (I had assumed that zero meant zero, because the sensor has built in dark count correction). Taking that into account means the open loop calibration based on raw images works nicely, and that is now what I’m using in th new version of the microscope software, where there is a recalibrate plugin. That code should work without the rest of the software, though I notice it seems to be missing a call to freeze_camera_settings before the correction is applied. R |
Complicated things about bayer pattern ! For the V2: Old script from RGB capture New script from BayerArray BAYER_OFFSETS = { def channels_from_bayer_array(bayer_array, bayer_order): where bayer_order comes from the array After this the same remark, the same table must work in all four flips cases. For the V1 I will try again. After that I have questions about the interference between the calibration and the white balance (red and blue gain). Regards, |
Hello,
I used your calibration script without hflip and vflip for the V2 successfully (except for a small blue band at the bottom).
Now I try with the V1, I spent a lot of time understanding the script (a good numpy exercise!) And I found an interference with hflip and vflip, the result is correct only if hflip = True and vflip = True . To put it in evidence here is a comparison of the 5 iterations (complete image, channels B G R). Do you have an idea ?
Note the other two cases are also bad
hflip vflip false false There seems to be a shift to the right
hflip vflip true true
The text was updated successfully, but these errors were encountered: