OpenCV Perspective Transform with Reference Object

Viewed 144

I'm a beginner with OpenCV, and I'm currently building out a project with a goal to find some relevant dimensions of a building (for now, just width and height in feet).

See image below:

enter image description here

I added a reference object with known world dimensions in front of the brick. Then, I was able to find the contours of that object to some reasonable accuracy (outlined in purple). So I now know the width and height in pixels as well.

What I'd like to do is use this information (from the reference object) to find the height and width of the building seen in the image taken. I could calculate this as is, but I imagine if the image is taken at some weird angle, the calculations would be off.

So, I'd like to preform some perspective transform on the image (likely via getperspectivetransform()), though I'm not sure how this would work in transforming the entire image (since the four corners of the building here won't necessarily always correspond to the four corners in the image).

Thanks! Any hints or guidance would be much appreciated

0 Answers
Related