Page 1 of 1

ImageMagickObject - compare - how to get pics difference in

Posted: 2014-01-06T13:39:56-07:00
by Pumbaa
Hi All.

I'm trying to get pics difference in %. I tried to use ImageMagickObject.dll within AutoIt language.
I can share code, but not sure it will be useful, so I'll just mention which function & parameters I use:
Function - Compare
Parameters: "-metric" = "MAE"
2 bmp images for comparison (640x480)
destination of comparison = "null:" (I don't need one more image - just % of source images distortion)

"Compare" itself works well, but returns empty string.
I make few series of compare operations & then terminate my program - at this moment my debug console gets a load of strings from ImageMagickObject.dll:
+>00:19:55 AU3Check ended.rc:0
>Running:(3.3.8.0) :\Program Files\AutoIt3\autoit3.exe "D:\1\1.au3"
10.8064 (0.0423779)
10.8064 (0.0423779)
10.8064 (0.0423779)
+>00:19:58 AutoIT3.exe ended.rc:0
+>00:19:59 AutoIt3Wrapper Finished
>Exit code: 0 Time: 4.167

Numbers like "10.8064 (0.0423779)" seem like what I need. They are greater when images are different & smaller when images are alike.
So the problem is that I can get them only after termination - not while script execution.

I tried to catch any events from dll & it's object inside my script, but it gave nothing.
I tried several cases with parameter "-format" - many of possible means mentioned here (http://www.imagemagick.org/script/escape.php) gave me real values during script execution, but "%[distortion]" gave empty string (may be that's not a result of operation, but parameter of compare execution).

I think I "cook" ImageMagickObject in a wrong way.

Grates to everyone who can offer solution in any programming language or helpful link.

Re: ImageMagickObject - compare - how to get pics difference

Posted: 2014-01-06T14:34:20-07:00
by snibgo
"compare" sends output to stderr, not stdout.

"%[distortion]" is for "compare". This goes to stdout.

Re: ImageMagickObject - compare - how to get pics difference

Posted: 2014-01-06T16:03:41-07:00
by fmw42
I have moved this from the Consulting forum. That forum is for paid consulting.

Re: ImageMagickObject - compare - how to get pics difference

Posted: 2014-01-06T23:26:52-07:00
by Pumbaa
snibgo wrote:"compare" sends output to stderr, not stdout.

"%[distortion]" is for "compare". This goes to stdout.
Well I already tried both of them & could not get anything except empty string... Could you provide a piece of working code?

Re: ImageMagickObject - compare - how to get pics difference

Posted: 2014-01-06T23:30:12-07:00
by Pumbaa
fmw42 wrote:I have moved this from the Consulting forum. That forum is for paid consulting.
Ok. Sorry if I placed it in a wrong place.

Re: ImageMagickObject - compare - how to get pics difference

Posted: 2014-01-06T23:32:04-07:00
by fmw42
In command line,

Code: Select all

compare -metric rmse image1 image2 null: 2>&1

Re: ImageMagickObject - compare - how to get pics difference

Posted: 2014-01-06T23:42:46-07:00
by snibgo
As fmw says for "compare".

The "convert" version is:

Code: Select all

convert image1 image2 -metric RMSE -format "%[distortion]" -compare info:
This returns just a floating-point number between 0 and 1. "compare" returns both this and the same number multiplied by quantum.

I know nothing about AutoIt language.

Re: ImageMagickObject - compare - how to get pics difference

Posted: 2014-01-08T10:28:55-07:00
by Pumbaa
I'd like to see code in any language, cause workable example for me will be a proof of right usage of ImageMagicObject & it's correct reaction.