At the moment I am currently programming code that should hopefully extract a registration plate from an image (it is read in as a Bitmap and is stored as JPEG). All extraction is from the bitmap image.

I am having trouble with extracting the yellow colours (for the registration) from the image. It currently scans each pixel, but they are not stored in an array or anything.

Is there anyone who knows how to extract yellow from an image using C++?? (I am using Borland v6).

Thanks in advance ;)

03-11-2005

DeX

Probably not the best way but you can use GetPixel to get the colour of a pixel in a specific DC.

03-11-2005

adrianxw

You are trying to write code that will enable you to get around the registration images people use to prevent script kiddies and other pests/parasites signing up for accounts?

03-11-2005

7stud

Is it possible to read the rgb colors of another application that is running on your computer?

03-11-2005

DeX

Yes, of course. You just need to get the drawing context of the particular element you want to get the rgb values from. Or you can just take a screen shot of the entire screen and read them from that. Maybe I misunderstood your question 7stud.

And I don't think this thread is about getting around those registration images. Even if it were it would be one thing to read a number plate off a clear image and another to read those registration images. Some of them totally screw around with the letters and I imagine it would be very very difficult to get a computer to read them.

03-11-2005

DougDbug

Quote:

...it is read in as a Bitmap and is stored as JPEG. All extraction is from the bitmap image.... but they are not stored in an array or anything.

Hmmmm... A bitmap is an array. So, if your are converting it to JPEG, that's the wrong apporach.

If your source of the image is the screen (not a file), then GetPixel is probably what you want.

If you have a bitmap file, you should use that directly. A bitmap file is not simply an array, but is the "easiest" format. It has a header, and some optional non-lossy RLE compression.

If you have a JPEG file, you'll need to convert it to a bitmap before any processing or analysis.

If you're interested, you can find the file-format specifications for bitmap and JPEG at wotsit.org.

03-12-2005

7stud

Quote:

Originally Posted by DeX

Yes, of course. You just need to get the drawing context of the particular element you want to get the rgb values from.

How would you do that?

Quote:

Or you can just take a screen shot of the entire screen and read them from that. Maybe I misunderstood your question 7stud.

Can an application obtain a screenshot?[/QUOTE]

03-12-2005

DeX

Yes you can.

If you want to grab the drawing context of a particular portion of a particular application then you just need to use something like Spy++ to find the window title or the window class name of the particular window you want to grab. Then you can use the FindWindow or FindWindowEx functions to get the hWnd of the window you want to grab. Then you can just use GetDC to get the device context of that window. Then it's just a simple matter of BitBlting the device context onto your window or your own memory DC. Or you can just use GetPixel directly on the DC you get from GetDC.

If you want to take a screenshot of the entire screen then you can use GetDC with the parameter 0 and it will return the device context of the entire screen. This lets you make a screen shot or draw directly onto the screen etc.