however in Windows batch (CMD) it produces error:
Code: Select all
convert large_image.png small_image.png miff:- |
compare -metric RMSE -subimage-search - miff:- |
convert - -delete 0 -grayscale
Code: Select all
convert large_image.png small_image.png miff:- |
compare -metric RMSE -subimage-search - miff:- |
convert - -delete 0 -grayscale
Code: Select all
convert large_image.png small_image.png miff:- |^
compare -metric RMSE -subimage-search - miff:- |^
convert - -delete 0 -grayscale rec601luma result.png
Code: Select all
compare -metric RMSE -subimage-search large_image.png small_image.png result.png
Code: Select all
convert highway_mask.png small_img_board_1.png miff:- |^
compare -metric RMSE -subimage-search - miff:- |^
convert - -delete 0 -grayscale
Code: Select all
convert highway_mask.png small_img_board_1.png miff:- | compare -metric RMSE -subimage-search - miff:- | convert - -delete 0 -grayscale
není názvem vnitřního ani vnějšího příkazu,
spustitelného programu nebo dávkového souboru.
convert -version
Version: ImageMagick 6.7.5-1 2012-01-28 Q8
Code: Select all
MS show:
Code: Select all
convert mandril3.jpg mandril3_156_22.jpg miff:- |\
compare -metric RMSE -subimage-search - miff:- |\
convert - -delete 0 -grayscale rec601luma result.png
Code: Select all
compare -metric RMSE -subimage-search large_image.png small_image.png result.png
Code: Select all
convert large_image.png small_image.png miff:- |^
compare -metric RMSE -subimage-search - miff:- |^
convert - -delete 0 -grayscale rec601luma result.png
Code: Select all
compare -metric RMSE -subimage-search large_image.png small_image.png result.png
Code: Select all
convert large_image.png small_image.png miff:- |^
compare -metric RMSE -subimage-search - miff:- |^
convert - -delete 0 result.png
Code: Select all
@ECHO OFF
cls
ECHO ON
REM To reduce processing time 18x I scale the image
REM 2.5s when I resized both images down at 25% of original dimensions
REM get original size of large image
for /f "usebackq tokens=1" %%o in (`convert map.png -format "%%wx%%h" info:`) do (
set original_size_1=%%o )
echo %original_size_1%
convert map.png -format "%%wx%%h" info:
@REM Scale map down
convert map.png -scale 25%% map_scaled.png
@REM generate mask mask3-1.png
compare -metric RMSE -subimage-search map_scaled.png sub_image_blue_2.png mask3.png
@REM Apply level(s) on mask
convert mask3-1.png -level 75%%,50%% mask_map_level_75_50_scaled.png
@REM Restore mask to original size
convert mask_map_level_75_50_scaled.png -resize %original_size_1% mask_map_locations.png
Is it possible to search this way if you have found more results? Using a mask instead cropping would be solution."The script srchImg.bat does two or more searches. The first resizes the images before searching; the last uses the results of the previous to make a crop that will be searched."
Code: Select all
REM 2.5s when I resized both images down at 25% of original dimensions
REM get original size of large image
for /f "usebackq tokens=1" %%o in (`convert map.png -format "%%wx%%h" info:`) do (
set original_size=%%o )
echo %original_size%
convert map.png -format "%%wx%%h" info:
@REM Scale map down
convert map.png -scale 25%% map_scaled.png
@REM generate mask mask4-1.png
compare -metric RMSE -subimage-search map_scaled.png sub_image_water.png mask4.png
@REM Apply level(s) on mask
convert mask4-1.png -level 75%%,50%% mask_map_level_75_50_scaled_water.png
@REM Restore mask to original size
convert mask_map_level_75_50_scaled_water.png -resize "%original_size%!" mask_map_locations_water.png
Code: Select all
compare -metric RMSE -subimage-search zurich.png sub_image_water.png zurich_water.png
Code: Select all
convert sub_image_water.png -scale 1x1! -scale 1024x632! zurich.png -compose Difference -composite -negate -grayscale Average zurich_water_2.png