I am working a some basic OpenCV tutorials. I am using intel relsense 435i. I encountered a weird issue that when i save same opencv image 2 times at the same time the brightness of the images are different in both cases. What could be the reason for this ?
import cv2
import numpy as np
cap = cv2.VideoCapture(1)
cap.set(3,640)
cap.set(4,480)
cap.set(10,100)
kernel = np.ones((3,3),np.uint8)
success, img = cap.read()
cv2.imwrite("testing.png",img)
while True:
success, img = cap.read()
cv2.imwrite("testing1.png",img)
if cv2.waitKey(1) == ord('q'):
break
cv2.destroyAllWindows()
Image saved before while loop:

Image saved before after loop:

I was expecting an image of similar brightness.
The realsense cameras have auto-exposure mode. So during initial few frames, the camera changes the exposure time to find the optimal exposure. This is why in initial few frames you see different brightness.
Source:- https://dev.intelrealsense.com/docs/high-dynamic-range-with-stereoscopic-depth-cameras#24-manual-vs-auto-exposure
P.S. I usually just let realsense run for few seconds, before doing anything with the image data.