aa2zz6 Posted January 3, 2016 Posted January 3, 2016 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.
mikell Posted January 3, 2016 Posted January 3, 2016 Did you try to put a value for the $tolerance parameter ?
aa2zz6 Posted January 3, 2016 Author Posted January 3, 2016 (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) EndFuncThis 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 January 3, 2016 by aa2zz6
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now