Help About Image Processing.

Discussion in 'The Projects Forum' started by yellowcloud, Oct 7, 2013.

  1. yellowcloud

    Thread Starter Member

    Jun 30, 2013
    32
    0
    Can I make a measurement of an image with using only a microcontroller?

    i.e. i have these image of a box and i need to know the length of the box and its width.

    if there is any link or pdfs that can make me understand how this will happen. please help. :D

    THANKS!
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    No, it is not possible with no other pieces of information.
    You need to know the focal length of the lens, the distance from the object, the resolution of the optical sensor or some way of calibrating the image.
     
    yellowcloud likes this.
  3. yellowcloud

    Thread Starter Member

    Jun 30, 2013
    32
    0
    Do you mean that it is not possible by using only a microcontroller??
     
  4. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    Whether you use a microcomputer or the most advanced Cray computer you cannot measure the size of an object in an image without some form of calibration.
     
    yellowcloud likes this.
  5. tracecom

    AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    Post the image; maybe there is a point of reference.
     
    yellowcloud likes this.
  6. yellowcloud

    Thread Starter Member

    Jun 30, 2013
    32
    0
    Lets say I used calibration.. will it work using microcontroller?
     
  7. yellowcloud

    Thread Starter Member

    Jun 30, 2013
    32
    0
    I am totally dont have any idea about image processing. >.< can you send links?
     
  8. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    With proper calibration, sure it can be done.
    It is done routinely with medical images, google maps, aerial photos, etc.
     
    yellowcloud likes this.
  9. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
    You need a sensor. The sensor is connected to microcontroller (uC).

    Example:
    Let say we have white surface. There is a box whose border is made with black color line.
    Sensor senses white, it sends 2 volt signal to uC. Then sensor moves X cm. When sensor encounters black, it sends 3 volts to uC. The program in uC registers the 3 volt signal and starts the count. When sensor sends second 3 volt signal (this tells us that the other side of the box have been reached), the count is stopped. Now you take the count and multiply by X cm, this tells you one of the dimensions of the box.
     
    yellowcloud likes this.
  10. yellowcloud

    Thread Starter Member

    Jun 30, 2013
    32
    0
    BTW. I plan to use camera as a sensor. and i will measure moving objects. like fish.
     
  11. wayneh

    Expert

    Sep 9, 2010
    12,107
    3,038
    To estimate the size of a fish, you'll need software for edge detection and pattern recognition - kind of like how smart cameras these days detect faces - plus the calibration already mentioned. That might be a bit much for a typical DIY micro project but maybe they're more powerful than I assume.
     
    yellowcloud and absf like this.
  12. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    Security cameras record and measure heights of people going by using a measuring tape set at the doorway.

    Put a ruler in your fish tank.
     
    yellowcloud and absf like this.
  13. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,803
    832
    I had mentioned this idea to the OP in another thread, with the caveat that I had not done it myself. However, I have seen other projects use this technique and felt it may apply to his problem. Also, I had done some research into edge detection and object recognition in the late 60s.

    Yellowcloud PMed me about this, as I had seen a couple of projects use OpenCV libraries and image tracking on microcontrollers. The others comments here are very useful. Yellowcloud, particularly pay attention to the issues of edge detection. Also, note the idea of security cameras and the measurements painted on the door frames of convenience stores. If to replace your array of LDRs with a color coded grid that the fish swim by, you can get a good estimate of size.

    Here are the links I provided Yellowcloud in a PM.
     
    yellowcloud likes this.
  14. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,797
    1,103
    So you want to use the camera to sense a moving object, process the image to recognise the object against a possibly complex background, measure the object with reference to some calibration image, and do all that in real time (more or less)? If so, methinks you'll need a very powerful microcontroller, possibly even the Cray Mr Chips mentioned in post #4 :).
     
    yellowcloud likes this.
  15. wayneh

    Expert

    Sep 9, 2010
    12,107
    3,038
    A $100 digital camera does it, so it can't be that bad.
     
    yellowcloud likes this.
  16. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,769
    969
    you can save yourself TONS of time and pick up a cognex camera (checker 4g,etc..) and the software.. It does measurement like this out of the box..
     
    yellowcloud likes this.
  17. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,803
    832
    Since I haven't actually done this and meant it only as a suggestion, it's time for me to leave this thread.

    Good luck
     
    yellowcloud likes this.
  18. yellowcloud

    Thread Starter Member

    Jun 30, 2013
    32
    0
    I have read all your thread replies. and I am reading some of the articles and documents online. As of now, this is what i got..

    I will design a box which will be open on both sides to serve as an entrance of the fishes. also i will put a calibration ruler or pattern or grid opposite to the camera inside the box. I will have a sensor that will tell the microcontroller that there is an object that crossed the entrance and that will trigger the uC to capture an image. And I will compare the image captured on a certain binary image of the fish to detect if its raelly a fish that i had capture or its only some dirt. If it passed. I will process now the image to know its dimension.

    Is this Good enough? Can a microcontroller process this without an external memory? I dont have to store the images. After I got its measurements, i will delete it. i will only need the measurements.

    PS. This should be a stand alone system.
     
  19. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    It is doable. But it depends on your definition of a microcontroller.
    In my books, a STM32F407 is still a microcontroller and should have the power to do what you require.
     
Loading...