Hi everyone, greetings from Italy.
I have a problem with OpenCV, I hope you can help me!
First thing, I’m not an experienced linux user, so I might be a little slow to catch your advices.
This is what happened:
yesterday I tried to run a code which worked really fine some months ago.
I also wanted to update OpenCV through pip update opencv-python
, being able to install the newer version, the 4.5.1.
After this update, I constantly get this error when running my code:
‘’’
File "file_name", line 327, in start_acquisition
cv2.imwrite(im_file1, img1)
cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-zuuo394f/opencv/modules/imgcodecs/scs/loadsave.cpp:753: error: (-215:Assertion failed) !_img.empty() in function 'imwrite'
‘’’
Thinking that the problem was caused by the update of OpenCV, I tried to install OpenCV 4.5.0 through the shell script in this repo GitHub - AastaNV/JEP but, unfortunately, my Jetson Nano crashed near the end of the installation.
I don’t really know what to do.
This is a piece of the code I wrote for my purpose, maybe it will give you furhter informations:
‘’’
CAM1 = cv2.VideoCapture(gstreamer_pipeline(sensor_id=0, exposuretime_low=16000000, exposuretime_high=16000000), cv2.CAP_GSTREAMER)
CAM2 = cv2.VideoCapture(gstreamer_pipeline(sensor_id=1, exposuretime_low=20000000, exposuretime_high=20000000), cv2.CAP_GSTREAMER)
_, img1 = CAM1.read()
_, img2 = CAM2.read()
im_file1 = user_dir + 'image_c1.jpg'
out_file1 = user_dir + 'c1' + '/image{0:02d}.npy'.format(order)
im_file2 = user_dir + 'image_c2.jpg'
out_file2 = user_dir + 'c2' + '/image{0:02d}.npy'.format(order)
cv2.imwrite(im_file1, img1)
cv2.imwrite(im_file2, img2)
cv2.destroyAllWindows()
CAM1.release()
CAM2.release()
‘’’
I don’t know if this further information will be helpful, but if I launch the dual_camera.py
script done by JetsonHacksNano, the two cameras work just fine!
Thanks in advance for any help!