EDIT: its searching for the green circle
Can someone check this to make sure it makes sense please?
Essentially I am trying to get real world locations of an object of a fixed size and shape given a single picture. There are some random numbers I have in there such as the "120" for calibrating because I did the math of how far my camera could pick up the objects as a singluar pixel and I estimated it to be around 120 feet. Obviously it couldn't in real life, but thats what I used just as a baseline. I was hoping someone could tell me if my code makes sense or it just happens to be somewhat accurate by mistake.
Most notes can be ignored due to me just using them cause I'm learning as I go, but I left them in for context just in case.
I = imread('GreenCalibrationX.jpg');
[rows, columns, numberOfColorChannels] = size(I);
if Red > 160 & Gre > 190 & Blu < 130
YellowPixCount = YellowPixCount +1;
RowBasedDia = LastPixRow - X1
ZCalibrationCoef = (columns/2016)
DistanceZ = (120*ZCalibrationCoef)/RowBasedDia
XCalibrationCoef = (470/columns);
DistanceX = ((1/150)*((-columns/2)+Y1)*XCalibrationCoef*(DistanceZ/3.5))
YCalibrationCoef = (635/rows);
DistanceY = ((1/150)*((rows
These are the outputs it gives for this image. They aren't perfect but they seem rather close to the real life ones.