CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: MSE of an image

  1. #1
    Join Date
    Feb 2010
    Posts
    1

    MSE of an image

    How can I calculate the Mean Square Error (MSE) of two RGB images (having 3 channels)? I am using the Opencv Library and it does not appear to have a function for this. Is there any formula? Please help..

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: MSE of an image

    Are you assuming they're aligned, or are you using the MSE to try and align them? (There are better ways to align images, but MSE is a conceptually simple one.)

    If the former, then pseudocode would be:
    Code:
    FOR every pixel
        FOR every channel
            ACCUMULATE the square difference in pixel channel intensity
    DIVIDE by the number of pixels*channels
    Using OpenCV, this may actually be easier if you convert your IplImage into a CvMat, because finding the squared difference of two matrices is very straightforward, as is accumulating an array. But the problem is trivial enough that a simple series of loops is probably about the same amount of code.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured