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 6093849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:36:29+00:00 2026-05-23T12:36:29+00:00

int DiferentPixels = 0; Bitmap first = new Bitmap(First.jpg); Bitmap second = new Bitmap(Second.jpg);

  • 0
int DiferentPixels = 0;
Bitmap first = new Bitmap("First.jpg");
Bitmap second = new Bitmap("Second.jpg");
Bitmap container = new Bitmap(first.Width, first.Height);
for (int i = 0; i < first.Width; i++)
{
    for (int j = 0; j < first.Height; j++)
    {
    int r1 = second.GetPixel(i, j).R;
    int g1 = second.GetPixel(i, j).G;
    int b1 = second.GetPixel(i, j).B;

    int r2 = first.GetPixel(i, j).R;
    int g2 = first.GetPixel(i, j).G;
    int b2 = first.GetPixel(i, j).B;

    if (r1 != r2 && g1 != g2 && b1 != b2)
    {
    DiferentPixels++;
    container.SetPixel(i, j, Color.Red);
    }
    else
    container.SetPixel(i, j, first.GetPixel(i, j));
    }
}
int TotalPixels = first.Width * first.Height;
float dierence = (float)((float)DiferentPixels / (float)TotalPixels);
float percentage = dierence * 100;

With this portion of Code im comparing 2 Images foreach Pixels and yes it work’s it return’s Percentage of difference ,so it compares each Pixel of First Image with pixel in same index of Second Image .But what is wrong here ,i have a huge precision maybe it should not work like that ,the comparison ,and maybe there are some better algorithms which are faster and more flexible .
So anyone has an idea how can i transform the comparison ,should i continue with that or should i compare Colors of Each Pixels or ….

PS : If anyone has a solution how to make Parallel this code ,i would also accept it ! Like expanding this to 4 Threads would they do it faster right in a Quad Core?

  • 1 1 Answer
  • 0 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-23T12:36:30+00:00Added an answer on May 23, 2026 at 12:36 pm

    One obvious change would be call GetPixel only once per Bitmap, and then work with the returned Color structs directly:

    for (int i = 0; i < first.Width; ++i)
    {
        for (int j = 0; j < first.Height; ++j)
        {
            Color secondColor = second.GetPixel(i, j);
            Color firstColor = first.GetPixel(i, j);
    
            if (firstColor != secondColor)
            {
                DiferentPixels++;
                container.SetPixel(i, j, Color.Red);
            }
            else
            {
                container.SetPixel(i, j, firstColor);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

int width = 2560; int height = 1440; int frameBuffer[width*height]; for (int i =
int x; printf(hello %n World\n, &x); printf(%d\n, x);
int main( ) { char str[200]; int n,tc; scanf(%d,&tc); while(tc--) { scanf(%d,&n); gets(str); puts(str);
int maxSumRec(const vector<int> &a, int left, int right){ if (left == right){ if (a[left]
int main() { char myString = NULL; realloc(&myString, 5); strncpy((char *)&myString, test, 5); }
int queryVector = 1; double similarity = 0.0; int wordPower; String[][] arrays = new
int a[][30]={{2, 16},{4, 8},{5, 16, 21},{2,6,3,5,6}}; Since the size of the second dimension is
int :: cadena calculatelenght(const cadena& a, const char* cad) { cadena c; int lenght
int placement[] = new int[8]; int placeQueen(int row) { if(row == 8) { printBoard();
int a[5]; cout << &a[1] << << &a[0] << endl; cout << (&a[1] -

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.