Page 1 of 1
Using Imagick to compare image
Posted: 2014-01-27T00:37:15-07:00
by kenau898
Good day all,
I am developing a web application capable of extracting a portion of an form image and compare it with the same image but has "ticks" selection made on the form. I understand that Imagick has a compare function i could use, but I would like to specific the exact coordinates to do the comparison.
Hope to get some advise.
regards,
Ken
Re: Using Imagick to compare image
Posted: 2014-01-27T10:25:23-07:00
by Bonzo
You need to supply a few more details Ken - IM version and platform - and a sample image is always helpful.
I assume as you have posted in the Imagick section you are using that API?
Re: Using Imagick to compare image
Posted: 2014-01-29T07:34:03-07:00
by kenau898
Hello Bonzo,
Thank you for replying. I am working on PHP and using Imagemagick 6.8.8-3. Working in XAMPP environment.
I am thinking to extract the difference based on a specific coordinates and compare with the based image to see if a "tick" is present. Attached is a cropped image of the image file where user will have to tick the check boxes.
Hope it help clear the doubt and looking forward to your reply!
thank you!
ken
Re: Using Imagick to compare image
Posted: 2014-02-04T12:10:21-07:00
by fmw42
This is in command line but could be run from PHP exec(). I do not know how to convert to Imagick.
1) warp snip2 to match snip1 (the viewport makes them the same size and the affine does the warp to align them according to control points I picked manually)
convert snip2.jpg -virtual-pixel black -define distort:viewport=228x127+0+0 +distort affine "151,16 151,14 188,16 188,14 151,109 151,107 188,109 188,107" snip2_warp.png
2) get the difference image
convert snip1.jpg snip2_warp.png -compose difference -composite -auto-level snip12_diff.png