Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   i want to draw circle on a image (any format..bmp,jpeg etc) (http://www.go4expert.com/forums/i-draw-circle-image-formatbmpjpeg-t18063/)

amit4540 17Jun2009 10:29

i want to draw circle on a image (any format..bmp,jpeg etc)
 
SIR,
i am doing a application for image processing where i am comparing 2 images,,and i want to highlight the pixcles where the diffrence occours with a red colored circle..i am able to compare the images but not able to highlight it with the circle..i want the pixel which is diffrent to ve the center of the circle..

Code: C#

if (img1.Width == img2.Width && img1.Height == img2.Height)
{
      //drawing
      g = pictureBox1.CreateGraphics();
      //////g = Graphics.FromImage(pictureBox1.Image);


      for (int i = 0; i < img1.Width; i++)
      {
            for (int j = 0; j < img1.Height; j++)
            {
                  img1_ref = img1.GetPixel(i, j).ToString();
                  img2_ref = img2.GetPixel(i, j).ToString();
                  if (img1_ref != img2_ref)
                  {
                        count2++;
                        flag = false;
 
                        //drawing
                        x = i;
                        y = j;
                        pen = new Pen(Color.Red);
                        g.DrawEllipse(pen, x, y,100,100);

                        //drawing
                        MessageBox.Show("error");

                        break;
                  }
                  count1++;
            }
            progressBar1.Value++;
      }
 
      if (flag == false)
            MessageBox.Show("Sorry, Images are not same , " + count2 + " wrong pixels found");
      else
            MessageBox.Show(" Images are same , " + count1 + " same pixels found and " + count2 + " wrong pixels found");
}
else
      MessageBox.Show("can not compare this images");

this.Dispose();


SaswatPadhi 17Jun2009 17:59

Re: i want to draw circle on a image (any format..bmp,jpeg etc)
 
Can you be more specific : what exactly do you mean by "not able to highlight it with the circle" ?

You have used g.DrawEllipse. Doesn't it work ??

amit4540 18Jun2009 10:01

Re: i want to draw circle on a image (any format..bmp,jpeg etc)
 
Quote:

Originally Posted by SaswatPadhi (Post 49761)
Can you be more specific : what exactly do you mean by "not able to highlight it with the circle" ?

You have used g.DrawEllipse. Doesn't it work ??



actully i am able to compare the images.. but i want to display a circle around the pixel "pixel as a center"which is diffrent... i also am able to draw a circle but my problem is the pixel which is diffrent should be at the center...of the circle


All times are GMT +5.5. The time now is 14:55.