Image type in

Last Reply on Jun 19, 2012 11:34 PM By Mudassar

Posted on Jun 18, 2012 11:38 PM

In c#, for colored image, we use Image<Bgr,Byte> .  i want to use this functionality in How do i write it in

Posted on Jun 18, 2012 11:38 PM

Could you please explain what you want to do?

Posted on Jun 19, 2012 08:11 AM Modified on on Jun 19, 2012 08:25 AM

This is a function written in c#. I want to write it in can u please help me to convert this code...

this is a function which is used to draw rectangle arround face and eyes... I used opencv library in this project...

 internal static Image<Bgr,Byte> Run(Image<Bgr,Byte> image)
         // throw new NotImplementedException();

          Image<Gray, Byte> gray = image.Convert<Gray, Byte>();    //Convert it to Grayscale

         //normalizes brightness and increases contrast of the image

          //Read the HaarCascade objects
          HaarCascade face = new HaarCascade("haarcascade_frontalface_alt_tree.xml");
          HaarCascade eye = new HaarCascade("haarcascade_eye.xml");

          //Detect the faces  from the gray scale image and store the locations as rectangle
          //The first dimensional is the channel
          //The second dimension is the index of the rectangle in the specific channel
      MCvAvgComp[][] facesDetected = gray.DetectHaarCascade(face,1.1, 10, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(20, 20));

          foreach (MCvAvgComp f in facesDetected[0])
              //draw the face detected in the 0th (gray) channel with blue color
              image.Draw(f.rect, new Bgr(Color.Blue), 2);

              //Set the region of interest on the faces
              gray.ROI = f.rect;
              MCvAvgComp[][] eyesDetected = gray.DetectHaarCascade( eye,1.1,10, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,new Size(20, 20));
              gray.ROI = Rectangle.Empty;

              foreach (MCvAvgComp e in eyesDetected[0])
                  Rectangle eyeRect = e.rect;
                  eyeRect.Offset(f.rect.X, f.rect.Y);
                  image.Draw(eyeRect, new Bgr(Color.Red), 2);
          return image;


Posted on Jun 19, 2012 11:34 PM

The type Image<Bgr,Byte>  does not belong to C# classes. You have used some ThirdParty control