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

Thread: MSE of an image

  1. #1
    Join Date
    Feb 2010

    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
    Seattle, WA

    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:
    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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)