imageSearch 在Win10与win7的运行问题

遇到了问题?请先进行搜索(中文和英文),然后在此提问

Moderators: tmplinshi, arcticir

d582693456
Posts: 4
Joined: 25 Nov 2018, 20:32
Contact:

imageSearch 在Win10与win7的运行问题

25 Nov 2018, 21:24

imageSearch 在Win10与win7的运行比较:

Code: Select all

	;获得每个角色牌区里的五张牌的校详情
getCardsDetail(role)
{
    cards := []
        for index_region, matchRegion in role.matchRegions
        {
            for index, element in Cards52
            {
                card := FindPicture(matchRegion,element)
                ;~ MsgBox,% card
                ;52次循环
                if (card != -1 && card != -2)
                {
                    cards.push(card)
                    break
                }
                if(index == 52)
                    MsgBox,% "有不识别的图片!"  matchRegion.start_x  "x"  matchRegion.start_y  "," matchRegion.end_x "x"  matchRegion.end_y
            }
        }   
        return cards
}

;图片匹配方法
FindPicture(matchRegion,card)
{
	local start_x  := matchRegion.start_x
	local start_y  := matchRegion.start_y
	local end_x := matchRegion.end_x
	local end_y := matchRegion.end_y
	local path := card.path
	ImageSearch, FoundX, FoundY,%start_x%,%start_y%, %end_x%,%end_y%,*190 %path%

	if(ErrorLevel  =2)
	{
		return -2
	}
	else if  ErrorLevel = 1
	{
		return -1
	}
	else
	{
		return card
	}
}
上个星期,我将在win7写的图片匹配脚本,移植到win10系统的笔记本里,结果发现在匹配的这个地方特别的慢,
匹配的思路是:将需要匹配的图片在图片库中进行穷举比较,当检索所有图片依然没有找到能匹配的时候,返回-1,检索成功则返回检索的对象,。
方法在win7的老笔记本里跑的很快,几乎秒读,可是移植到win10的系统里,就需要大约3秒的时间才能检索完毕,虽然依然能匹配成功,请教各位大佬,有遇到过相同问题吗?如何解决?
d582693456
Posts: 4
Joined: 25 Nov 2018, 20:32
Contact:

Re: imageSearch 在Win10与win7的运行问题

25 Nov 2018, 22:18

我循环了100次检索,然后发现,检索的速度与%start_x%,%start_y%, %end_x%,%end_y%检索的区域大小有关
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
Contact:

Re: imageSearch 在Win10与win7的运行问题

30 Nov 2018, 11:35

what is the advantage of this class over a simple imagesearch function?
d582693456
Posts: 4
Joined: 25 Nov 2018, 20:32
Contact:

Re: imageSearch 在Win10与win7的运行问题

04 Dec 2018, 20:22

SL5 wrote:
30 Nov 2018, 11:35
what is the advantage of this class over a simple imagesearch function?
thanks for you answer,I had Solved the question by used LoadPicture()
load picture to cache before loop lots of pictures, imageSearch can reduce 90% time!
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
Contact:

Re: imageSearch 在Win10与win7的运行问题

05 Dec 2018, 01:48

thanks! great work.

BTW maybe something similar is possible with dynamic Autohotkey (dynAhk)?
I use it a lot but it sometimes loads 2 seconds for a simple message box.

your cachePic-System
probably not help if i use only some few pics(?)

have you ever compared it to the java sikuli2 ? Me, yes for long time. i keep a aye of sikuli.

Return to “请求帮助”

Who is online

Users browsing this forum: No registered users and 21 guests