studying screen shot image

This is a discussion on studying screen shot image within the C++ Programming forums, part of the General Programming Boards category; Hi I have a chat app written in java - that has been converted to an exectuable. I cant see ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    190

    studying screen shot image

    Hi
    I have a chat app written in java - that has been converted to an exectuable.
    I cant see the controls because it was written in swing, however when yuo "chat" there are a lot of emoticons used. I want to write a c++ program that can recogonise those emoticons (from a DB of the images).

    Currently I am screenshotting the application window with
    Code:
    PrintWindow(hwnd, hdc, PW_CLIENTONLY);
    My first question is how would people recommend analyzing the image data?
    assuming I have a load of images in a folder that are 25x25 pixels, what is the best way to search for them in the window screen shot?
    Im thinking possibly reading 10 specific pixels at known locations from all of the stored images and saving them in an array. Then look at pixels on the main screen shot that are dispersed the same amount. If you find them, check the rest of the pixels match?

    My second question is I want a snipping tool like the one in windows 7 however that always selects an image of the same size. Does anyone know of one, or how I could go about this in C++?
    Thanks

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    I don't understand what you're trying to accomplish with PrintWindow. Why not just grab an HDC for the window directly?
    Code:
    HDC hdc = GetDC(hwnd);
    COLORREF cr = GetPixel(hdc, x, y);
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    190
    OK So I need to backtrack abit because I am struggling with images as it is.
    If I have an image (I dont mind what format - whatever is best for C++ to handle (and easy)) I am struggling to find out what I need to do to load the pixel data into a 2D array - Im not asking please do it for me, I just would like some direction because I dont want to have to go downloading random libraries to try and get it to work.
    I then want to search the loaded image for another image - obviosuly a smaller one, to see if the larger one contains the smaller one.
    So I am thinking I need to load the image data of the two images, and then run through the bigger one looking to see if it contains the data of the smaller one - I think I can probably work that bit out - its just the loading of the data I am struglling with

  4. #4
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Are you trying to write a separate program that reads the window of the chat program? I.e., you can't modify the code of the chat program, right?

    You say you're currently using PrintWindow. If you've gotten that to work then you can access the 2D array of pixels using GetPixel.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. rogue - the screen shot collection
    By Salem in forum General Discussions
    Replies: 8
    Last Post: 05-23-2011, 05:44 PM
  2. Image over the whole screen!
    By IM! in forum C++ Programming
    Replies: 6
    Last Post: 03-20-2005, 12:02 PM
  3. screen shot
    By muttski in forum Windows Programming
    Replies: 5
    Last Post: 10-30-2002, 03:10 PM
  4. How to put my image to screen?
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 04-23-2002, 04:17 AM
  5. Allegro Screen Shot Freezes
    By compjinx in forum Game Programming
    Replies: 2
    Last Post: 03-06-2002, 10:40 PM

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