Results 1 to 4 of 4

Thread: Measure photo

  1. #1

    Default 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. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default 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.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3

    Default 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. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default 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.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. How to make svg painters measure text correctly
    By ceraolo in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2014, 10:35
  2. Measure Qt Application Performance
    By JcPep in forum Newbie
    Replies: 0
    Last Post: 16th July 2013, 11:50
  3. Time measure beetwen events
    By felo188 in forum Qt Programming
    Replies: 1
    Last Post: 18th August 2011, 15:18
  4. Replies: 2
    Last Post: 26th April 2010, 08:58
  5. How to measure memory of Qt Application,
    By rajeshs in forum Qt Programming
    Replies: 2
    Last Post: 10th July 2007, 18:03

Bookmarks

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.