title: OpenCV Perspective Transform with Reference Object
body: <p>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).</p>
  <p>See image below:</p>
  <p><a href="https://i.stack.imgur.com/l5lz9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l5lz9.jpg" alt="enter image description here" /></a></p>
  <p>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.</p>
  <p>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.</p>
  <p>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).</p>
  <p>Thanks! Any hints or guidance would be much appreciated</p>