Jump to content

Find BMP in another BMP (imagesearch)


junkew
 Share

Recommended Posts

Hi,
thanks for sharing the script.
Unfortunately i can not get it running.

I would like to find a bmp within another bmp with minimal length of code, can anybody please help me?
I played around with the code on page 1 and would like to post my attempts but i am honestly not sure which attempts made sense anyway. I tried to
to comment/uncomment but i guess, this was related to other scope (with catching active windows, where i gotsome error with regions).

Can anyboday please help me, how to find bmp in bmp?
I know, in the following code there are a lot of things missing, but i am already lost to know, which parts are relevant or not, sorry for that :(

Local $Find_this_image = @ScriptDir & '\folder_symbol.bmp'
Local $within_this_image = @ScriptDir & '\desktop.bmp'

Local $aResult = findBMP($within_this_image, $Find_this_image, $c24RGBPartialMatch)
_ArrayDisplay($aResult)


Many thanks for help and understanding
tobius
 

Edited by tobius
Link to comment
Share on other sites

"Unfortunately I cannot get it running" is very vague, is it compiling without errors?

1. run the first example and post the output/results

2. experiment with your examples, it seems you want to find something on the desktop

3. post your bmp files

The way you save bmp files to disk can already make a huge difference in finding. The slightest mismatch on a pixel will give no result.

Describe what your expectations are and make sure you look in FAQ for other solutions

 

 

Link to comment
Share on other sites

  • 4 months later...

I was search for ages for something like this. Though I implemented it in Powershell .Net. I was having trouble with small images. Until I went through and checked the formula for find the x and y coordinates.

Quote

 

$foundAtTop = int($iPos / $BMP1lineWidth) -$i

$foundAtLeft =  int(mod($iPos,$bmp1linewidth) / $imgBytes)

 

If you rewrite it like this:

Quote

$foundAtLeft =  int(mod($iPos,$bmp1linewidth) / $imgBytes)

$foundAtTop = int(($iPos - ($foundAtLeft * $imgBytes)) / $bmp1linewidth)

You will get the exact coordinates, without any rounding issues.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...