I Have not done any image work in c++, and I have only been programming for a few months now learning myself so not sure just how difficult this will be. I want to be able to take a small selection of my screen, say for example the system tray in the bottom right hand corner. I want c++ to store this as an image in the directory the executable was run from. I will rename this file whatever the time is on the clock its taken (10.09pm). Eventually I will have a few different captures stored, and then if one of those clock times (images) are identical to the current "scan" I can output a message / code etc.
I would then like the program to be able to "scan" that same area of the system tray and tell me if it finds a match of the exact same image (assuming everything else in the system tray was identical along with the time).
What would be the best way to go about this / get started?
So the first thing I would do is simplify your task, at least to start off since you've admitted to not having much experience. Scanning and comparing the actual desktop introduces a race condition that you do not need, I would instead take a screen shot and work with that. Now since you are working with an image you'll need to decide on a file format that you are comfortable working with, I'd suggest something that isn't fancy to start off with like a bitmap which is larger then most image formats need to be but it's easy to work with. From there it's just a matter of identifying how that section of the image is stored in the file and doing a comparison between the two samples.
Since someone is going to ask anyway, could you outright state that you are specifically trying to work with images and that Task Scheduler isn't what you are looking for?
Thanks for the reply, Yea I am looking to work purely with just images and a screenshot was my original idea but I was wondering if its possible to screenshot certain "areas" of the screen instead of the entire desktop for efficiency, that would in effect act as a "scan" of an area where an image would be. I just used the system tray as a a generic example its not required :).
Also (although this would be after I have completed what I want!) when comparing the images say 30-40+ of them you wanted to compare against, I presume loading the images to memory before any scan/comparisons take place would be the fastest most efficient way to do it?
I'm sure there is a way to take a shot of only a specific area, there most defiantly is a way to take a screen shot of a specific window and even a specific rendering context within a window but since your example is the clock in the tool bar I wouldn't worry about that just yet. A screenshot happens so fast on modern hardware that a human being would not be able to perceive any increase of efficiency there might be.
And loading them into memory is the ONLY way to compare images. The CPU does not deal with data directly on the HDD. If you are asking if you should load them all at once and keep them in memory then the answer is yes, the less you hit the Hard Drive the better your program will perform.
Yeah that's cool then. Ideally I want to be able to take a screenshot within a program (lets say a screenshot within a certain area of notepad) so no matter where notepad is, the same area within that is always used as a comparison. As I mentioned before I have done no image work in c++ and overall have a few months worth of experience with c++ and I have been getting better and better over the last few months.
I think cimg library is probably the best place to get started but any small examples, or links to relevant content would be really appreciated.