My project has a camera which through opencv tracks 4 laserpoints on a wall.
But when there is low light in the room, the image contains a lot of noise due to the sensitivity.
Is it possible to change the exposure to get rid of the false positives?
I am using Jetson Nano with Rpi2 Camera and Python 3.6 with opencv
def gstreamer_pipeline (capture_width=1280, capture_height=720, display_width=1280, display_height=720, framerate=60, flip_method=0) :
return ('nvarguscamerasrc ! '
'video/x-raw(memory:NVMM), '
'width=(int)%d, height=(int)%d, '
'format=(string)NV12, framerate=(fraction)%d/1 ! '
'nvvidconv flip-method=%d ! '
'video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! '
'videoconvert ! '
'video/x-raw, format=(string)BGR ! appsink' % (capture_width,capture_height,framerate,flip_method,display_width,display_height))
cap = cv2.VideoCapture(gstreamer_pipeline(flip_method=0), cv2.CAP_GSTREAMER)
Thank you!
it worked for me when i executed the command from the link you provided in the terminal
gst-launch-1.0 -e nvarguscamerasrc wbmode=0 awblock=true gainrange="4 4" ispdigitalgainrange="1 1" exposuretimerange="400000 400000" aelock=true ! nvvidconv ! xvimagesink
But how can i implement it to Python?
You would change the pipeline creation used for video capture (the function you’ve posted above).
Check this post where a user implemented fixed gains but uses parameter for exposure (note that this case was capturing in I420 format, for your case you would just look at nvarguscamerasrc options).
I put it in to the start:
Changed the gain so that the noise disappears completely when there is low light.
Thank you for your help!
def gstreamer_pipeline (capture_width=1280, capture_height=720, display_width=1280, display_height=720, framerate=60, flip_method=0) :
return ('nvarguscamerasrc wbmode=0 awblock=true gainrange="1 1" ispdigitalgainrange="1 1" exposuretimerange="5000000 5000000" aelock=true ! '
'video/x-raw(memory:NVMM), '
'width=(int)%d, height=(int)%d, '
'format=(string)NV12, framerate=(fraction)%d/1 ! '
'nvvidconv flip-method=%d ! '
'video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! '
'videoconvert ! '
'video/x-raw, format=(string)BGR ! appsink' % (capture_width,capture_height,framerate,flip_method,display_width,display_height))