automatic image recognition

This is a discussion on automatic image recognition within the Game Programming forums, part of the General Programming Boards category; hi i wanted to ask if anyones anything about image recognition. e.g. i want to take the screenshot of a ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    13

    automatic image recognition

    hi

    i wanted to ask if anyones anything about image recognition.

    e.g. i want to take the screenshot of a game board, where dice are displayed
    then this code should given the bitmap recognize which number the dice is showing.

    i know that neural nets can do such things. ..does anyone know where i can get a package that can do that

    or maybe other ways /other packages that can achieve this goal

    very thankful for any information

    asta

  2. #2
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Designing, then training a neural net for that might be harder than you think. Unless the image is always the dice in a similar orientation/size.

    You're probably better off using some image processing algorithms to find the edges of the dice. Then counting the dots should be pretty easy. This all depends on how complicated the board looks and how much the orientation of the dice changes from shot to shot.
    You might want to try using something like matlab if you have it.

  3. #3
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Couldn't perceptrons also accomplish this? But yes i agree, an algorithm would be the best implementation here.
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,588
    > e.g. i want to take the screenshot of a game board, where dice are displayed
    Is this an actual picture of dice, taken with a video camera?

    Or is it just computer drawn images of dice?
    Because all you need to do is sample a few choice pixels, and you're on your way.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    13
    hi

    the image is computer drawn, and the size and orientation are fixed.
    i have already done it by using certain pixels.

    i would like to do this a little more generally though, just incase the dice changes position, even if size and orien. stay the same.
    if the software were to change the dice position even by a few pixel, my whole program would crash (or not crash, but you know what i mean).

    so i was looking for something more advanced thats already been developed.

    thanks for any info

    asta

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,588
    Fairly basic edge detection then?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    As Salem says, use Edge Detection to find the edge of the dice, then use your current approach to poll pixels relative to the edge position.

  8. #8
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,246
    Quote Originally Posted by Perspective View Post
    As Salem says, use Edge Detection to find the edge of the dice, then use your current approach to poll pixels relative to the edge position.
    Without knowing exactly what these images look like it's hard to guess how easy it is. I suspect extremely easy. Once you detect the edges of the die, take the image contrast to maximum. Now count the number of connected black blobs inside the edges you detected.

  9. #9
    Registered User
    Join Date
    Sep 2006
    Posts
    13
    so what can you suggest to do to detect the edges?

  10. #10
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,588
    I'm assuming that typing into a search engine "edge detection algorithms" is something you've tried already.

    If you haven't, then try it.

    If you think "wow, what a good idea", then perhaps programming isn't for you.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  11. #11
    Lean Mean Coding Machine KONI's Avatar
    Join Date
    Mar 2007
    Location
    Luxembourg, Europe
    Posts
    444
    Ok, this might be a little advanced but here's how you could do it (and how I did it):

    Method 1: You blur the image (Gaussian Blur), you apply the Canny Edge detector followed by the Hough transform to delineate the image and find the local maxima in the accumulator to see how many circles have been detected by Hough.

    Method 2: You use a Dot/Circle Filter, you move the pattern everywhere on the image and measure the response. This is called Correlation and it's used to measure similarity.

    Method 3: You use a Dot Filter and calculate the sum of square differences (ssd) and you count the minima in the image. The sum will be lowest for the dice dots.


    Stuff you might need:

    An overview about edge detection: http://cvlab.epfl.ch/~fua/courses/vi...otes/Edges.pdf

    Delineation (Hough Transform): http://cvlab.epfl.ch/~fua/courses/vi...elineation.pdf

    Texture: http://cvlab.epfl.ch/~fua/courses/vi...es/Texture.pdf

    Correlation: http://cvlab.epfl.ch/~fua/courses/vi...tes/Stereo.pdf

  12. #12
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    since the dice are always in a fixed position and they are always oriented the same, it should be fairly easy to just compare the background image (without dice) witht eh new image (with dice) and pick out the delta ( the part that has changed, i.e. the dice). Get shots of each of the combinations and then feed them randomly into a simple perceptron network over a weekend, just randomly shuffle the images and do a slow train (error *.01). Use each pixel as an input into the network, with 11 hidden layer neurons and 11 output neurons. You should end up with a fairly fast and accurate NN that recognizes the result.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  13. #13
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    KONI likes researching for people ?

  14. #14
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Am I the only one that is reminded of Duck Hunt for the NES and the way that it and similar games detected shots by the zapper? Ah, good times. Good times.

  15. #15
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Eh, Duck Hunt for NES... Wow, shoot the white coloured pixels with your grey coloured pixels aka the gun

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. Replies: 1
    Last Post: 05-27-2009, 12:46 PM
  3. Simple Image Processing
    By ejohns85 in forum C++ Programming
    Replies: 4
    Last Post: 03-19-2009, 12:10 PM
  4. Replies: 6
    Last Post: 03-03-2005, 02:52 AM
  5. Replies: 4
    Last Post: 03-02-2003, 08:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21