Re: RMS error [message #39357] |
Thu, 13 May 2004 06:36 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Julio writes:
> I'd like to thank you for the discussion and the clues! However, I'd
> like to know a way to extract from the image the coordinates to be put
> in the RMS equation.
Sigh...
I'll let somebody else field this.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: RMS error [message #39358 is a reply to message #39357] |
Thu, 13 May 2004 06:22  |
julio
Messages: 31 Registered: December 2003
|
Member |
|
|
Hello all...
I'd like to thank you for the discussion and the clues! However, I'd
like to know a way to extract from the image the coordinates to be put
in the RMS equation.
Thanks...
Julio
James Kuyper <kuyper@saicmodis.com> wrote in message news:<40A23C7B.3070003@saicmodis.com>...
> Craig Markwardt wrote:
>> David Fanning <david@dfanning.com> writes:
>>
>>
>>> Julio writes:
>>>
>>>
>>>> I'd like to calculate Root Mean Square error using a base image and a
>>>> secondary image. How can I do that? Clues are welcome!
>>>
>>> rms_error = Sqrt( Total((img_1 - img2)^2)/N_Elements(img_1) )
>>
>>
>> Hey David, I'll pile on too. The problem I see with the above
>> expression is that there could be an offset between the two images,
>> which you are including in your TOTAL expression, and hence biasing
>> the rms value. How about the following instead?
>
> The Root Mean Square difference between two images is defined as the
> square ROOT of the MEAN of the SQUAREd differences between the images.
> If there's an offset between the two images, that offset is supposed to
> be squared, and is supposed to contribute to the mean, and therefore to
> an increase in the RMS error.
>
>> rms_error = stddev(img_1 - img2)
>
> That's a different statistic, also useful, but it's not the RMS error.
>
> Note: if there's an offset difference, there might also be a scaling
> difference. Then the most appropriate statistic to use gets even more
> complicated.
|
|
|
Re: RMS error [message #39374 is a reply to message #39358] |
Wed, 12 May 2004 08:11  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Paul Van Delst <paul.vandelst@noaa.gov> writes:
> Craig Markwardt wrote:
>> David Fanning <david@dfanning.com> writes:
>>
>>
>>> Julio writes:
>>>
>>>
>>>> I'd like to calculate Root Mean Square error using a base image and a
>>>> secondary image. How can I do that? Clues are welcome!
>>>
>>> rms_error = Sqrt( Total((img_1 - img2)^2)/N_Elements(img_1) )
>>
>>
>> Hey David, I'll pile on too. The problem I see with the above
>> expression is that there could be an offset between the two images,
>> which you are including in your TOTAL expression, and hence biasing
>> the rms value.
>
> Errmm... isn't that intended? RMS errors include the bias. Std deviations don't. At any
> rate, that's how I use 'em. This is what I've got on my wall:
It's a good question for the original poster!
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: RMS error [message #39375 is a reply to message #39374] |
Wed, 12 May 2004 08:02  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
Craig Markwardt wrote:
> David Fanning <david@dfanning.com> writes:
>
>
>> Julio writes:
>>
>>
>>> I'd like to calculate Root Mean Square error using a base image and a
>>> secondary image. How can I do that? Clues are welcome!
>>
>> rms_error = Sqrt( Total((img_1 - img2)^2)/N_Elements(img_1) )
>
>
> Hey David, I'll pile on too. The problem I see with the above
> expression is that there could be an offset between the two images,
> which you are including in your TOTAL expression, and hence biasing
> the rms value. How about the following instead?
The Root Mean Square difference between two images is defined as the
square ROOT of the MEAN of the SQUAREd differences between the images.
If there's an offset between the two images, that offset is supposed to
be squared, and is supposed to contribute to the mean, and therefore to
an increase in the RMS error.
> rms_error = stddev(img_1 - img2)
That's a different statistic, also useful, but it's not the RMS error.
Note: if there's an offset difference, there might also be a scaling
difference. Then the most appropriate statistic to use gets even more
complicated.
|
|
|
Re: RMS error [message #39376 is a reply to message #39375] |
Wed, 12 May 2004 07:56  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Craig Markwardt wrote:
> David Fanning <david@dfanning.com> writes:
>
>
>> Julio writes:
>>
>>
>>> I'd like to calculate Root Mean Square error using a base image and a
>>> secondary image. How can I do that? Clues are welcome!
>>
>> rms_error = Sqrt( Total((img_1 - img2)^2)/N_Elements(img_1) )
>
>
> Hey David, I'll pile on too. The problem I see with the above
> expression is that there could be an offset between the two images,
> which you are including in your TOTAL expression, and hence biasing
> the rms value.
Errmm... isn't that intended? RMS errors include the bias. Std deviations don't. At any
rate, that's how I use 'em. This is what I've got on my wall:
RMS = SQRT( TOTAL( Xtruth - Xpredicted )^2 / N )
and
StdDev = SQRT( TOTAL( Xpredicted - MEAN(Xpredicted) )^2 / N )
I think it really requires the OP to state more precisely what it is he's looking for.
Blind use of statistical formula is usually a no-no.
> rms_error = stddev(img_1 - img2)
That works - same as the RMS defn above where Xtruth = img1-MEAN(img1) and Xpredicted =
img2-MEAN(img2). But is that what the OP needs/wants?
paulv
|
|
|
Re: RMS error [message #39378 is a reply to message #39376] |
Wed, 12 May 2004 07:42  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Craig Markwardt writes:
> Hey David, I'll pile on too. The problem I see with the above
> expression is that there could be an offset between the two images,
> which you are including in your TOTAL expression, and hence biasing
> the rms value.
An offset!? We better take global warming into
account, too. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: RMS error [message #39379 is a reply to message #39378] |
Wed, 12 May 2004 07:13  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
David Fanning <david@dfanning.com> writes:
> Julio writes:
>
>> I'd like to calculate Root Mean Square error using a base image and a
>> secondary image. How can I do that? Clues are welcome!
>
> rms_error = Sqrt( Total((img_1 - img2)^2)/N_Elements(img_1) )
Hey David, I'll pile on too. The problem I see with the above
expression is that there could be an offset between the two images,
which you are including in your TOTAL expression, and hence biasing
the rms value. How about the following instead?
rms_error = stddev(img_1 - img2)
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: RMS error [message #39392 is a reply to message #39379] |
Tue, 11 May 2004 16:23  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Rick Towler writes:
> A couple of questions:
>
> 1) Shouldn't you first cast img_1 and img_2 to something other than byte?
> Subtracting byte arrays will result in points that wrap:
>
> IDL> print, 213B-215B
> 254
>
> When you really want:
>
> IDL> print, 213s-215s
> -2
Yes, of course. I assumed these were 16-bit images,
because, well..., I just did. :-)
> 2) Is this correct for true color images?
Don't know. I've never done this myself. I was just up
getting a cup of tea when the message came in and I
happened to have my Gonzalez and Woods sitting at hand.
This is what I found when I looked RMS error up in the
index. It's what happens when you give a guy with a
compulsion to communicate a little bit of knowledge. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: RMS error [message #39395 is a reply to message #39392] |
Tue, 11 May 2004 15:34  |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
"David Fanning" wrote ...
> Julio writes:
>
>> I'd like to calculate Root Mean Square error using a base image and a
>> secondary image. How can I do that? Clues are welcome!
>
> rms_error = Sqrt( Total((img_1 - img2)^2)/N_Elements(img_1) )
A couple of questions:
1) Shouldn't you first cast img_1 and img_2 to something other than byte?
Subtracting byte arrays will result in points that wrap:
IDL> print, 213B-215B
254
When you really want:
IDL> print, 213s-215s
-2
2) Is this correct for true color images? Do you total the square of the
differences for each color plane or do you total the square of the sum of
the differences for each plane? That is:
IDL> print, TOTAL((img_1 - img_2)^2)
56825.0
or:
IDL> dr=reform(img_1[0,*,*] - img_2[0,*,*])
IDL> dg=reform(img_1[1,*,*] - img_2[1,*,*])
IDL> db=reform(img_1[2,*,*] - img_2[2,*,*])
IDL> print, total((dR + dG + dB)^2)
170325.
Now that I think about it the first approach looks correct but since I am
not an image analyst and I don't have even the most basic of references I
thought I would ask.
-Rick
|
|
|
Re: RMS error [message #39400 is a reply to message #39395] |
Tue, 11 May 2004 14:14  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Julio writes:
> I'd like to calculate Root Mean Square error using a base image and a
> secondary image. How can I do that? Clues are welcome!
rms_error = Sqrt( Total((img_1 - img2)^2)/N_Elements(img_1) )
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|