Extracting range of an object from an image using object's dimesntions
1 次查看(过去 30 天)
显示 更早的评论
So I have a code that detects and isolates three objects and yields their dimensions in pixels (diamters, perimeter..), I have the ground truth data for the distance but I would like to be able to estiamte the distance from the inforamation I have efficiently, suggestions to how this could be done would be great.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166764/image.png)
The picture shows a frame from over a thousand frames I have that show the object slowly drifting closer, so obviously the closer it is the larger its measurements are.
0 个评论
采纳的回答
Image Analyst
2017-8-18
Measure the diameters and separation for images taken at multiple distances. Then divide the actual diameters and separation by the pixel ones to get a spatial calibration. Then plot spatial calibration vs. distance to get a curve. Fit to a polynomial with polyfit to get a formula where you can convert the real world diameters into a distance from the camera.
2 个评论
更多回答(1 个)
Matt J
2017-8-18
For a simple pinhole camera model (and ignoring off-axis effects), the relationship between distance and perimeter (in pixels) should be
distance=K/perimeter
Just fit the constant K with as many (perimeter,distance) measurements that you have.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Feature Detection and Extraction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!