aa2zz6

Can Image Search have a Shade Variation

3 posts in this topic

Can Image Search have a Shade Variation? If we have two colors but one has a slight shade is there a way to differentiate and tell the program that although it's a shade lighter it might be the correct image.

Share this post


Link to post
Share on other sites



Did you try to put a value for the $tolerance parameter ?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

In the ImageSearch.au3 I set the tolerance to 255 as a test to see if it would pick anything up but it didn't.

Func _ImageSearch($findImage,$resultPosition, ByRef $x, ByRef $y,$tolerance=255, $HBMP=0)
   return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance,$HBMP)
EndFunc

This is the running script I'm using for the first image. The image specified below is the dark green image. The Lighter green image is sitting on the desktop.

#include <WinAPI.au3>
#include <ImageSearch.au3>
#include <GDIPlus.au3>
#include <MsgBoxConstants.au3>

$fileA = @ScriptDir & "\pics\Green.png"
_GDIPlus_Startup()

$hImageA = _GDIPlus_ImageLoadFromFile($fileA)
$hBitmapA = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageA)

$x = 0
$y = 0

$result = _ImageSearch($hBitmapA, 1, $x, $y, 20, 0)

If $result > 0 Then
    MsgBox($MB_SYSTEMMODAL, "Test", "Color was found", 1)
EndIf

 

Edited by aa2zz6

Share this post


Link to post
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