I'm trying to send data to my phone by filming a blinking LED. This works fine most of the time, but for some frames I get a rolling shutter effect in my camera preview, which messes up my data transfer. Is there a way to remove this rolling shutter effect?
I am working with Google's cameraAPI2 and a Nexus 6 (but I've seen the same effect on a Samsung S7). I record at 20 fps and the LED blinks at a frequency of 20 Hz. My images have a format of 320x240 with YUV_420_888. Here are my current settings for a CaptureRequest:
CONTROL_AE_MODE CONTROL_AE_MODE_OFF
CONTROL_AWB_MODE CONTROL_AWB_MODE_OFF
EDGE_MODE EDGE_MODE_OFF
CONTROL_MODE CONTROL_MODE_OFF
SENSOR_EXPOSURE_TIME 500000
SENSOR_FRAME_DURATION 50000000
I've already tried playing with exposure time and frame duration to no effect. The same effect can be observed by simply opening the stock camera app and filming a LED close up. Example
The right half of the picture shows the old frame and the left half shows the new frame.
Is there a way to fix this? Does Android have camera vsync?
Edit: I changed the frequencies to 20Hz.
Edit 2: I got it working by performing Canny Edge Detection and then Standard Hough Line Transformation on the image using opencv. After getting the line coordiantes from the Hough Line Transformation, I checked if the line is horizontal. Then I split the image along this line and only used the larger area for my calculations.