Want to try the Distance measurment for arducam stereo camera

1.Which seller did you purchase the product(s) from?
Other Arducam Distributor (Tokopedia)
2.The Model number of the product(s) you have purchased?
IMX219 8MP For Raspberry Pi
3.Which Platform are you using the product(s) on?
Raspberry Pi 4B
4.Which instruction are you following?
https://www.arducam.com/docs/cameras-for-raspberry-pi/synchronized-stereo-camera-hat/opencv-and-depth-map-on-arducam-stereo-camera-hat-tutorial/#video-tutorial
5.Has your product ever worked properly?
work intermittently
6.What problems are you experiencing?
Hello i’m using arducam sync stereo camera hat and right now i have a research about converting depth map image to distance data and i’m using this code as my references : https://github.com/LearnTechWithUs/Stereo-Vision/blob/master/Main_Stereo_Vision_Prog.py and when i tried, this error message appeared but the program is still working , so what should i do to fix this error ? thank you
7.What attempts at troubleshooting have you already made?
ask a friend
8.How would you like us to help you?
show the solutions step by step

Hi there,

try this:

i see, also i want these distance data is sent to STM32F4 (Microcontroller that i use right now) for communication with UART, can i do it ? and how can i do it ? thank you

@wong also, did you already try that ? did that work ? i want to know your results about distance measurement using depth mapping

@wong excuse me but i got this message, what should i do ? thank you

Hi,

Yes, I tested it and it works fine.
Please use the attachment I provided to try, the way to get the depth is to click on the object you want to measure in the disparity map.
Regarding the use of UART, you can google how to use RaspberryPi’s UART with Python.

@wong hello but i got a error message “TypeError : ‘NoneType’ object is not subscriptable” what should i do ? thank you

 

I see that the number of error lines seems to be different from the Python file I provided. Can you use the script I provided without modifying it?

Hello @wong i have tried your Phyton file and it works well, but there’s something that i don’t understand about these data, from what i know i’m sure that is not random data just like before when i click the object, can you explain these data please, which one the distance data ? thank you

Hi there

The third value should be distance.

Related references:
https://docs.opencv.org/3.4/d9/d0c/group__calib3d.html#ga1bc1152bd57d63bc524204f21fde6e02

 

@wong so the first value and second value are the x y of disparity and the third value is the distance, which means the distance is 6cm based on my data ? but why minus ? it is because of ddepth ? thank you.

@wong and also the distance, how many meters away ? thank you

Your distance information seems to be incorrect, can you provide the correct disparity map?

The actual tested distance is about 10 meters, the error is proportional to the distance, the farther the distance, the greater the error.

@wong this is my disparity map, can you help me to fix the error ?

@wong and also, for RaspberryPi’s UART with Python i have a reference like this for the python code, based on this reference link : https://raspberrypisolveissuetutorial.blogspot.com/2019/11/uart-communication-between-stm32-nucleo.html can i combine this code to the main code ? and for the data i need to use this distance data right ? also can i combine the serial code to the main code ? what should i do ? thank you.

Hi @AldifaJulian

The disparity map looks good, what is the actual distance you measured?

For other issues, you can add the UART code to the main program, and directly get the treeD data and send it to the serial port instead of clicking the mouse to get the data.

@wong I want to measure the distance of the object stairs, so can you help me what should i do ? thank you

Hi @AldifaJulian

I can’t help you with the specific implementation, but I will try my best to help you get the correct distance data.

Now I need you to provide a clear disparity map and corresponding distance output (please use screenshots, the photos taken by the phone are not clear), and tell me the actual distance.

Hello @wong here’s the screenshot of distance data based on the camera

and the actual distance is around 45cm just like this

so what should i do with the error ? thank you

Hi @AldifaJulian

Sorry for the late reply,
Thank you for the information, I will test further to confirm the problem.