Jump to content
spoo

Image _search(opencv)

Recommended Posts

Requirements

1.import the image

2.Select the portion of an (Region of Interest ) image.

3.find all the instances of that selected image , from the same image 

4.Provide the count and Annotated locations to the users

 

 

I have already got Template_match working (as shown in the below code), but how do i ask the user to select the portion of the image and then use match_template  to find how many such image portions are present 

 

#AutoIt3Wrapper_UseX64=n ; In order for the x86 DLLs to work
#include "OpenCV-Match_UDF.au3"

_OpenCV_Startup();loads opencv DLLs
_OpenCV_EnableLogging(True,True,True) ;Logs matches, errors in a log file and autoit console output.

;Please note that these examples might not work as the match pictures have to be found with the exact same size on your screen.


;Example 1
ShellExecute("https://xyz.com");Open Website tv.com
$Match1 = _MatchPicture(@ScriptDir&"\Match\easy.png", 0.70,False,10,500);Try to find the match picture on the screen. Number of tries: 10, Sleep between each try: 500ms.
If Not @error Then
    _MarkMatch($Match1) ;Debugging: Draws a rect on the screen/coordinates of the match to show the user where the match was found
    Sleep(100)
    _ClickMouse($Match1, "left",1) ;Calculates the center of the match and clicks the left mouse once on click position
EndIf

Sleep(1000)
 

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

×
×
  • Create New...