Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1058027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:57:41+00:00 2026-05-16T17:57:41+00:00

Is there a way to find the mean square error in matlab between 2

  • 0

Is there a way to find the mean square error in matlab between 2 images A,B(say) in true color of dimension 256*256*3 ? The mathematical formula for a matrix say M1 and M2 is as under

mean sq err=1/n*n { summation (square[M1(i,j)-M2(i,j)])}

where i stands for row and j stands for column

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:57:42+00:00Added an answer on May 16, 2026 at 5:57 pm

    Well, start writing! Eat a programming elephant (even the smallest ones) one byte at a time!

    How do we form the difference of two images? First, convert them to doubles in case they are uint8 images, as is common. DO IT! TRY IT! Learn to write matlab code by doing so, and do it in pieces, so you can follow what you did.

    First of all, you have not told us if this is to be a MSE over all three channels. Your formula says that we should end up with a different MSE for each of the red, green and blue channels.

    double(M1) - double(M2)
    

    Now, how would you form the square of each difference? Use the .^ operator.

    (double(M1) - double(M2)).^2
    

    Next, mean squared error implies that we take the mean over all rows and columns. A simple way to do this is with the mean function. This call takes the mean across the rows.

    mean((double(M1) - double(M2)).^2,2)
    

    And the next one takes the mean down the columns.

    mean(mean((double(M1) - double(M2)).^2,2),1)
    

    The result will be a 1x1x3 vector. Convert that into a 1×3 vector using the reshape function. (The squeeze function would help as well.) Packaging it all into one line, we get this…

    MSE = reshape(mean(mean((double(M1) - double(M2)).^2,2),1),[1,3]);
    

    If this seems complex to you, then you are best off splitting it into several lines, with comments that remind you what you did for later.

    But the point is, you create an operation in matlab by breaking it down into manageable pieces.

    EDIT:

    In many cases, people want the RMSE (root-mean-squared-error) which has units the same as your original numbers. It is just the square root of the MSE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to find adjacent cells in a quadtree subdivision? I mean
Is there another way to find out the status of services on AppEngine other
Is there a way to find out which Javascript function is fired by click
Is there a way to find out programmatically what TestCategory is running in a
Is there any way to find out or store which app is accessing an
Is there a way to find out where a Python object was instantiated the
is there any way to find it? for example: var number=5; $(#+>number).remove(); but I
Is there any way to find what is a size of a code and
Is there a way to find if a list contains duplicates. For example: list1
Is there any way to find the cursor is at the top of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.