Extracting range of an object from an image using object's dimesntions

조회 수: 3 (최근 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.
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.

채택된 답변

Image Analyst
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
Alla
Alla 2017년 8월 21일
Thank you for your answer Image Analyst, and I must take the chnace to also thank you for your very helpful code for detecting blobs which I used a variation of for the early stage of this.
The image shows my plot from about a 100 samples because I only have ground truth at a 10 frame interval (the plot has distance on the x axis and diameter on the Y axis), when I use ployfit I get a third degree polynomial that is completely inaccurate, so I'm sure Im doing something wrong here, any advice?
Image Analyst
Image Analyst 2017년 8월 21일
Attach the actual data. Maybe a 1/x curve will be better.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Matt J
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.
  댓글 수: 1
Alla
Alla 2017년 8월 21일
Thanks Matt
My problem is both practical than conceptual,my goal is to have a good range estimator that relies on thresholding those objects, I'm not sure if this is the best way to do it or not but I am giving it a shot, now I'm struggling with getting it to work, it might be very simple for you but unfortunately I'm not the best at this stuff

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by