Note that there are some explanatory texts on larger screens.

plurals
  1. POImage Comparing and return Percentage
    primarykey
    data
    text
    <pre><code>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 &lt; first.Width; i++) { for (int j = 0; j &lt; 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 &amp;&amp; g1 != g2 &amp;&amp; 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; </code></pre> <p>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 ....</p> <p>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?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload