Metric - tried all.
"-similarity-threshold 0 -dissimilarity-threshold 1" - I will try this.
So far, tried -similarity-threshold from 0.2 to 0.99
Images are at different scales - no, they are not.
Small image is exracted from large image.
No resize was done on either image after extraction.
Images are large, resize to minimum dimension is 10 pixels -
The small image (to be searched), is now 210x84 pixels.
Resize would make it 25x10 pixels and completely destroy the text.
Already tried crop, 2 different crops, images are attached, but results are also totally wrong.
Scripts - right, already tried yout BAT file:
http://im.snibgo.com/srchimg.htm
But, sorry to say this, not working at all.
I mean, no bad results, I mean BAT not working.
First of all: @call echoOffSave - I do not have that file/function.
I have foud your script directly from google search, not your main page (with other instructions).
Maybe on the main page it says : "you need to also download this and that....".
Full output from script:
Code: Select all
test02 testing1_Page_22.png first_name_02.png
Code: Select all
rem Searches image testing1_Page_22.png for image
first_name_02.png.
'echoOffSave' is not recognized as an internal or external command, operable program or batch file.
call setInOut testing1_Page_22.png si
'setInOut' is not recognized as an internal or external command, operable program or batch file.
if "" == "1" (
set DEBUG_OUT=_si_dbg
if "" == "" set siDEBUG_STROKE=-fill None -stroke #f00
)
set SRCNAME=testing1_Page_22
set SRC=
set SUB=first_name_02.png
set fBAT=
if "" == "" set fBAT=NUL
if "" == "" set siMETRIC=RMSE
set TMPEXT=.miff
set TMPDIR=d:\_Temp\
set TMPSRC=d:\_Temp\\siSrc.miff
set TMPSUB=d:\_Temp\\siSub.miff
if not "" == "0" (
del d:\_Temp\\siSrc.miff 2>nul
del d:\_Temp\\siSub.miff 2>nul
)
if not "NUL" == "NUL" del NUL 2>nul
FOR /F "usebackq" %L IN (`convert -ping first_name_
02.png -format "subW=%w\nsubH=%h\nMinDim=%[fx:w<h?w:h]" info:`) DO set /A %L
set /A subW=211
set /A subH=84
set /A MinDim=84
FOR /F "usebackq" %L IN (`identify -format "OFFSET_
X=%X\nOFFSET_Y=%Y" `) DO set /A %L
echo MinDim=84 Offset=(,)
MinDim=84 Offset=(,)
if 84 GEQ 10000 (
call :ResizeSrch 0.1 1000
call :CropSrch !COMP_XW! !COMP_YW! 2000
) else if 84 GEQ 5000 (
call :ResizeSrch 0.2 500
call :CropSrch !COMP_XW! !COMP_YW! 1000
) else if 84 GEQ 2000 (
call :ResizeSrch 0.5 200
rem call :CropSrch !COMP_XW! !COMP_YW! 400
call :CropResizeSrch !COMP_XW! !COMP_YW! 100 5 20
call :CropResizeSrch !COMP_XW! !COMP_YW! 40 10 10
call :CropResizeSrch !COMP_XW! !COMP_YW! 20 20 5
call :CropResizeSrch !COMP_XW! !COMP_YW! 10 50 2
call :CropSrch !COMP_XW! !COMP_YW! 4
) else if 84 GEQ 1000 (
call :ResizeSrch 1 100
rem call :CropSrch !COMP_XW! !COMP_YW! 200
call :CropResizeSrch !COMP_XW! !COMP_YW! 100 5 20
call :CropResizeSrch !COMP_XW! !COMP_YW! 40 10 10
call :CropResizeSrch !COMP_XW! !COMP_YW! 20 20 5
call :CropResizeSrch !COMP_XW! !COMP_YW! 10 50 2
call :CropSrch !COMP_XW! !COMP_YW! 4
) else if 84 GEQ 500 (
call :ResizeSrch 2 50
call :CropResizeSrch !COMP_XW! !COMP_YW! 100 5 20
call :CropResizeSrch !COMP_XW! !COMP_YW! 40 10 10
call :CropResizeSrch !COMP_XW! !COMP_YW! 20 20 5
call :CropResizeSrch !COMP_XW! !COMP_YW! 10 50 2
call :CropSrch !COMP_XW! !COMP_YW! 4
) else if 84 GEQ 200 (
call :ResizeSrch 5 20
call :CropResizeSrch !COMP_XW! !COMP_YW! 40 10 10
call :CropResizeSrch !COMP_XW! !COMP_YW! 20 20 5
call :CropResizeSrch !COMP_XW! !COMP_YW! 10 50 2
call :CropSrch !COMP_XW! !COMP_YW! 4
) else if 84 GEQ 100 (
call :ResizeSrch 10 10
call :CropSrch !COMP_XW! !COMP_YW! 20
) else if 84 GEQ 50 (
call :ResizeSrch 20 5
call :CropSrch !COMP_XW! !COMP_YW! 10
) else if 84 GEQ 20 (
call :ResizeSrch 50 2
call :CropSrch !COMP_XW! !COMP_YW! 2
) else if 84 GEQ 10 (
call :ResizeSrch 50 2
call :CropSrch !COMP_XW! !COMP_YW! 2
) else (FOR /F "usebackq tokens=1-4 delims=()@, " %R IN (`compare -similarity
-threshold 0 -dissimilarity-threshold 1 -subimage-search -metric RMSE first_na
me_02.png NULL: 2>&1`) DO (
set COMP_INT=%R
set COMP_FLT=%S
set COMP_XW=%T
set COMP_YW=%U
) )
rem 20 is percentage reduction, eg 50 for 50. May b
e <1.
rem 5 is multiplier (=100/20)
echo ResizeSrch 20 5
ResizeSrch 20 5
rem The convert and compare could be combined into
one convert.
set COMP_XW=0
set COMP_YW=0
set TMPSRC_RES=d:\_Temp\\testing1_Page_22_si_20.mif
f
if not "" == "0" (del d:\_Temp\\testing1_Page_22_si
_20.miff 2>nul )
if not exist d:\_Temp\\testing1_Page_22_si_20.miff
convert +repage -resize 20% d:\_Temp\\testing1_Page_22_si_20.miff
convert.exe: no images defined `d:\_Temp\\testing1_Page_22_si_20.miff' @ error/c
onvert.c/ConvertImageCommand/3210.
convert first_name_02.png -resize 20% d:\_Temp\\siS
ub.miff
set COMP_XW=
FOR /F "tokens=1-4 usebackq delims=()@, " %R IN (`c
ompare -similarity-threshold 0 -dissimilarity-threshold 1 -subimage-search -
metric RMSE d:\_Temp\\testing1_Page_22_si_20.miff d:\_Temp\\siSub.miff NULL: 2>&
1`) DO (
rem echo %R %S %T %U
set COMP_INT=%R
set COMP_FLT=%S
if not "%T" == "" set /A COMP_XW=%T*5
if not "%U" == "" set /A COMP_YW=%U*5
)
(
rem echo compare.exe: unable to open
set COMP_INT=compare.exe:
set COMP_FLT=unable
if not "to" == "" set /A COMP_XW=to*5
if not "open" == "" set /A COMP_YW=open*5
)
if "0" == "" exit /B 1
if not "" == "0" (del d:\_Temp\\testing1_Page_22_si
_20.miff 2>nul )
rem echo COMP_XW, YW = 0 0
exit /B 0
rem !COMP_XW!,!COMP_YW! are coords for top-left of
estimated result.
rem 10 is plus or minus for tolerance in both direc
tions.
echo CropSrch !COMP_XW! !COMP_YW! 10
CropSrch !COMP_XW! !COMP_YW! 10
set /A cropL=!COMP_XW!-10
Missing operator.
set /A cropT=!COMP_YW!-10
Missing operator.
if 1 LSS 0 set cropL=0
if 1 LSS 0 set cropT=0
set /A cropW=211+10+10
set /A cropH=84+10+10
set COMP_XW=1
set COMP_YW=1
convert +repage -crop 231x104+1+1 +repage
d:\_Temp\\siSrc.miff
convert.exe: no images defined `d:\_Temp\\siSrc.miff' @ error/convert.c/ConvertI
mageCommand/3210.
FOR /F "tokens=1-4 usebackq delims=()@, " %R IN (`c
ompare -similarity-threshold 0 -dissimilarity-threshold 1 -subimage-search -
metric RMSE d:\_Temp\\siSrc.miff first_name_02.png NULL: 2>&1`) DO (
rem echo %R %S %T %U
set COMP_INT=%R
set COMP_FLT=%S
if not "%T" == "" set /A COMP_XW+=%T
if not "%U" == "" set /A COMP_YW+=%U
)
(
rem echo compare.exe: unable to open
set COMP_INT=compare.exe:
set COMP_FLT=unable
if not "to" == "" set /A COMP_XW+=to
if not "open" == "" set /A COMP_YW+=open
)
rem echo COMP_XW, YW = 1 1
exit /B 0
rem set /A COMP_XW+=
rem set /A COMP_YW+=
if "" == "1" (
set /A endX=1+211-1
set /A endY=1+84-1
rem FIXME: does draw respect offsets? Add +repage to make this irrelevant.
convert +repage -draw "rectangle 1,1 !endX!,!endY!"
)
if not "NUL" == "NUL" echo set COMP_XW=1&set COMP_Y
W=1&set COMP_FLT=unable&set COMP_CROP=211x84+1+1 1>NUL
FOR /F "usebackq" %L IN (`convert -ping first_name_
02.png -format "centX=%[fx:int(1+w/2)]\ncentY=%[fx:int(1+h/2)]" info:`) DO set /
A %L
set /A centX=106
set /A centY=43
if not "" == "0" (
del d:\_Temp\\siSrc.miff 2>nul
del d:\_Temp\\siSub.miff 2>nul
)