-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exact distance of image #268
Comments
The best approach may be to try using the ZoeDepth models which are built to give metric distances as an output. Otherwise, if you know the range of the depth of the image, you can convert the midas output into true depth using the formula: Where the variables
Here, the min_depth & max_depth refer to the minimum & maximum depth values in the image (i.e. you'd need to know something like, 'the closest point is 2 meters away, the farthest is 17 meters'. Then invert those numbers to calculate A and B). Though this approach will be sensitive to errors in the min/max depth values as well as the midas output (again, probably better to use the ZoeDepth models). |
Thank you for the given formulas. It is working. Together with several points with known distance it gives proper results.
|
I am confused. Is there any way to extract the exact distance(in meters) of any pixel in the image? Assume I don't know any other points other than the predicted values. Can I still get the exact distance out of the image? |
Metric depth models (like ZoeDepth) attempt to do this. With relative depth models (like MiDaS) you need additional information to convert the relative mapping to an absolute one. |
give me the end-to-end complete code for calculating the depth using webcam and convert the |
If you know the real depth (meters) for 1 pixel, would it be enough to convert the rest of the depths to real distance too? |
Not quite, it's sort of a '2 knowns to figure out 2 unknowns' situation. You'd need to know the true depth for at least 2 pixels to be able to solve for That being said, if you want to try to fit using only two pixels, you can setup a system of 2 equations using the known pixels (and the equation from before) and solve it to figure out
And for clarity, I'm just getting this by re-arranging the equations:
|
Ya that's a clever idea to stabilize the prediction. If that's still inconsistent, it should even be possible to grab the entire region of pixels belonging to the car and use a least-squares type of fit (like what @ximader posted) to further reduce the sensitivity to errors on individual pixels. |
|
I think the idea is if you know the depth for some part of the image, then you can convert the relative depth into real distances. If you don't know the depth, then it's better to use the metric depth (ZoeDepth) models. |
i have got midas depth but i need to convert this into distance like meter and centimeter. Can anyone help me?
The text was updated successfully, but these errors were encountered: