Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Stuck Porting Script

$
0
0
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
DSCHROEDER /d/apps/ImageMagick-6.8.8-Q16
$ ./maxima -r 3 -n 5 -u p -m rmse -g -t 90 hat.jpg hat_out5.png
787,72 gray=60395,235,92.1569%
787,42 gray=59624,232,90.9804%
818,42 gray=59110,230,90.1961%
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.

Darren

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>