Page 1 of 1

screen capture code?

Posted: Mon Jun 20, 2005 6:08 am
by Rabid Mantis
I'm making something similar to a macro program, and I need it to be able to check for certain images on certain parts of the screen.

Does irrlicht have anything that might help to capture whatever happens to be on the screen within a certain rectangle and store it, then compare the captured image to a pre-loaded bitmap? The program itself will have no interface, other than the irrlicht console, so it will be capturing whats going on on the windows desktop mostly.

I don't know how to get the actual capture... Did any kind of capture or screenshot code get added in?

after that, i was hoping irrlicht would have something for comparing the images. If not, it shouldnt be too hard to write some pixel-by-pixel comparison code.

thanks

Posted: Mon Jun 20, 2005 6:29 am
by Cristian
Yo DUDE! Are you out of your mind?(:) just kidding) Comparing image similarities is just being devlelopped as a top feature for security cameras and you want it in Irrlicht?
If you want a start try making some position intervals and check if a mesh is positioned inside the interval.

Code: Select all

core::vector3df<int> PosArrayInterv[1];
PosArrayInterv[0]= core::vector3df <int> (3,3,3);
PosArrayInterv[1]= core::vector3df <int> (4,4,4);
//If the mesh is between the two positions
if (mesh->getPosition()<PosArrayInterv[1] && mesh->getPosition()>PosArrayInterv[0])
{
//Do what you want to do
}

Posted: Mon Jun 20, 2005 6:39 am
by Rabid Mantis
No, i think I gave you the wrong idea. I'm not comparing similarities, i want to test to see if that exact image is in a certain spot. the image being tested for is identical to the loaded bitmap its being compared to.

example: I've got a bitmap of a program icon. I want to capture a rectangle from a certain place on the desktop and see if that icon is there. It may not make sense WHY i'd want to do this, but just go with it :p

my main concern is GETTING the screen capture. I pretty much know how to compare them pixel by pixel if irrlicht can't do it.

Posted: Mon Jun 20, 2005 7:24 am
by Ronin
Take a look at this, maybe it is what you are looking for...

http://irrlicht.sourceforge.net/phpBB2/ ... shot#40542

Posted: Mon Jun 20, 2005 8:10 am
by Rabid Mantis
It does look useful, but I cant find alot of the code you're using in the API.... things like CreateOffscreenPlainSurface and GetFrontBufferData. I even seached my irrlicht source code and didnt come up with anything. Is that dx stuff?

I wanted to see if GetFrontBufferData captured the entire desktop or only the active program.

Posted: Mon Jun 20, 2005 8:28 pm
by Ronin
Yes it is directx, you need the sdk to compile it...

The directx code captures the whole screen including other windows if you are in windowed mode. About the opengl code I'm not quite sure at the moment.

Posted: Mon Jun 20, 2005 9:39 pm
by puh
Why, Ronin? Your code for opengl you've posted here worked for me. Thank you!