1. Novice
Join Date
Jul 2019
Posts
17

## Measure photo

Question:
Is there a way to measure a box in a photo

Say i put a circle on a frame on the wall
This circle is 6 inches in diameter
I take a picture of this frame
Find someway to move a bounding box to the size of the frame in qml
Can i calculate the width and height of the frame

Any thoughts???

2. ## Re: Measure photo

Sounds like you need to read about edge detection and other image processing techniques. There is nothing built-in to Qt or QML as far as I know, but the OpenCVS libraries are extensive and have been used in Qt applications. That might be huge overkill for what you want. Depending on what you are actually trying to do, something as simple as converting the image to B&W and then running an edge detection filter on it might be enough to get you started. Google is your friend.

3. Novice
Join Date
Jul 2019
Posts
17

## Re: Measure photo

Example
What if i take a picture of a big picture frame with a hand placed 6inch reference square on it.
Then draw a box around the 6 inch reference
Then draw a box around the picture frame.

If i can the calculate how many pixels for the 6 inch square i can get how many pixels are in 6 inches.

I can then try and calculate how many pixels high and wide the picture frame is....from the prior calculations i know how many pixels are in 6 inches.... if the frame is 12x12 i would simply do the math...

Does this soumd doable.....just have to be rough numbers.

4. ## Re: Measure photo

Yes, it is doable if:

- you can detect the 6-inch square in your image
- you can detect the box around your "frame" (whatever that is) in your image

If you can do this interactively, then it is relatively simple: Display the image at full resolution. Click first on opposite diagonal corners of your 6-inch square. Count the number of pixels on the horizontal side - that's pixels / inch (ppi) in the x direction. Do the same for the vertical side - that's pixels / inch for y. Next, click on opposite diagonal corners of your boxed frame. Count the number of x and y pixels, divide by the appropriate ppi measurement and you get your frame dimensions in inches.

If you have to do this automatically, then it's hard, because you have to do the image processing needed to detect each of these squares. And you need to be able to do it presumably on arbitrary images which could have rectangular things in them that aren't your squares, the camera could be tilted so the squares are skewed or not aligned with the x-y axis, and lots of other possible defects. But once you have found the two rectangles and correct for these defects, the math is the same.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.