3
I was testing an algorithm that returns to me the area of objects based on a reference, a priori this gave me results quite close to the real, when the reference was the same height of the measured object, but I decided to observe at a different time, with that I found that the given area was larger than I expected.
Reference is the left circle and the object is right on the 11cm diameter tube.
I imagined it was due to the curvature of the tube, but as it was quite high I imagined it was due to the proximity of the camera, and as I am using a pixel counting method may have occurred this problem.
I wonder if there is another way to get this area other than by counting the pixels or some way to reverse this difference?
Post the code you use and explain how you do the calculation. If your reference object has not changed in size, there is no reason to stop working (if you did it right: knowing the size of the reference object in cm, just find it in the image and measure its size in pixels to know the "scale" in which the image is; this same ratio is then applied to the new object you want to measure, and that is why there is the reference object).
– Luiz Vieira
Obviously the proximity of an object to the camera will make it bigger. Its calculation is valid only with captures in similar conditions, objects at the same distance. The camera cannot capture the distance between the objects on the Z axis.
– Celso Marigo Jr
Besides, what do you mean "different height"? If the objects were not photographed by the same camera and at the same distance (as our colleague @Celsomarigojr said), it makes no sense to apply this ratio.
– Luiz Vieira
different height I meant that what I wanted to measure was on another object.
– D.Cavalcante
but had not really thought about this discrepancy with the Z axis, I will redo my code here, thanks for the help Celso Marigo and Luiz Vieira
– D.Cavalcante
Not at all. Remember that if the objects are at different distances, the ratio (pixel-in-image x cm-in-real-life) does not apply because they are no longer on the same "scale" (of size in the image, even). If you had two cameras you could even try to estimate size based on the calculated distances from the effect Parallax, but it is more usual (and easier) to keep the single camera perpendicular to the scene and the items (reference and interest) at the same distance.
– Luiz Vieira
Got it, thank you very much
– D.Cavalcante
Not at all. I voted to close as out of scope because there’s not much to answer involving programming, actually. In addition, a possible hint of the problem has already been given in comments. But if the problem is something different, edit it or open a new question. :)
– Luiz Vieira