tobybreckon / zed-opencv-native-python

Native stereo capture from the StereoLabs ZED USB 3 series of stereo cameras with OpenCV in Python
MIT License
19 stars 6 forks source link

Error - selected camera # 0 : resolution does not match a known ZED configuration profile. #3

Closed namratadutt closed 3 months ago

namratadutt commented 4 months ago

Hello. I have been trying to run the code but it keeps giving me this error. I am using a zed mini and this is my configuration file SN17782661.conf.txt. I am trying to run this on windows.

tobybreckon commented 4 months ago

This only works with the older SED 1 model of camera - to make it work with the zed mini I think you may need to update coe lines 196 + 197 of zed-stereo.py to match the resolutions used by zed mini (in theory they should be the same for 2k, HD, FHD, VGA - but for some reason they are not it appears). I don't have a ZED mini to test with - looking at the spec sheet (here: https://www.generationrobots.com/media/zed-mini-camera-datasheet.pdf) it looks like all the resolutions are correct.

Does you ZED camera work with OpenCV in general? (test using this script: https://github.com/tobybreckon/python-examples-ip/blob/master/save_video.py) What resolution is the input / output video?

This could also be a Windows issue, as I have only tested and can support under Linux.

namratadutt commented 4 months ago

Hello, I have changed lined 196+197 according to this sheet (https://support.stereolabs.com/hc/en-us/articles/360007395634-What-is-the-camera-focal-length-and-field-of-view).
The code that you attached works. I changed the width and height to 1280 and 720 in the code. And it saves the output video as well.

tobybreckon commented 4 months ago

Excellent - does it work now? if so can you post the revised lines for 196+197?

namratadutt commented 4 months ago

Sorry about the confusion. The code that you attached to check if the camera works with OpenCV works. But even with changing the resolution, zed-stereo.py gives the same error about the resolution. I will try to run it on Linux and see if that helps.

namratadutt commented 3 months ago

Hello. I couldn't use Linux but I tried it on Mac. It gives me this error.

Screenshot 2024-05-09 at 12 16 59 PM

I noticed your configuration file has p1 and p2 for the right and left cameras. My configuration files don't have p1 and p2. It had k1, k2, k3, and k4. How would you recommend changing the zed_configuration.py?

tobybreckon commented 3 months ago

OK, so in zed_configuration.py I think you need to change lines 50-52 to:

    Lk3 =  float(left['k3'])
    Lk4 = float(left['k4'])
    Lk5 = 0

Lines 60-62 to be:

   Rk3 =  float(left['k3'])
   Rk4 = float(left['k4'])
   Rk5 = 0

and lines 74-75 to be:

distCoeffsR = np.array([[Rk1], [Rk2], [Rk3], [Rk4], [Rk5]])
distCoeffsL = np.array([[Lk1], [Lk2], [Lk3], [Lk4], [Lk5]])

Let me know if this works.

namratadutt commented 3 months ago

Hello, Thank you so much for your help. It works. (Also, I think you meant lines 62-64.)

tobybreckon commented 3 months ago

Excellent - are you able to submit a pull request with these code changes in it?

I can then amend the master branch code to work with both ZED and ZED mini for others.