I'm porting Fred's maxima script (http://www.fmwconcepts.com/imagemagick/maxima/index.php
) because I can't figure out this part:
match=`compare -metric $metric $subimagesearch $dir/tmpI.mpc \( -size 1x1 xc:"gray($valpct%)" \) null: 2>&1`
I think I understand that I can do img.SubImageSearch() and that works fine but it only returns the best match. I really need all matches and their confidence values in a collection that I can iterate through. I have found nothing to do this so this is why
I resort to maxima.
I've done this to create the gray color with the value percent. The problem is that img.SubImageSearch() doesn't seem to return a percent. There is a SimilarityMetric but that doesn't look right.
MagickColor graylevel = new MagickColor("xc:gray(" + percent + ")");
MagickImage gray1x1 = new MagickImage(graylevel,1,1);
Fred's routine outputs data like this
$ ./maxima -r 3 -n 5 -u p -m rmse -g -t 90 hat.jpg hat_out5.png
where the first value is X,Y and gray is listed in 3 types.
Perhaps the real question is how to use these xc: -format "%" info: commands in Magick.NET.
val=`convert $dir/tmpI.mpc -format "%[$maximum]" info:`
valfrac=`convert xc: -format "%[fx:$val/$qrange]" info:`
valpct=`convert xc: -format "%[fx:100*$val/$qrange]" info:`
val8=`convert xc: -format "%[fx:round(255*$valfrac)]" info:`
Once I can get the value output from the format info commands the perpaps i can pass in the gray percent to make my color to do a subimage search.