IMAGE<BGR, byte> frame = capture. Queryframe ()//Get the video frame of the camera
IMAGE<BGR, byte> frame2 = frame. CONVERT<BGR, byte> (); Converts a frame to an RGB type, which corresponds to a three-dimensional array
Image<gray, byte> grayframe = frame. Convert<gray, byte> ()//Convert frame to Gray type, corresponding to one-dimensional array
IMAGE<YCC, byte> currentycrcbframe = frame. CONVERT<YCC, byte> ()//Convert frame to YCBCR type, corresponding to three-dimensional array
Image<gray, byte> skin = new Image<gray, byte> (frame. Width, frame. Height);//Build Grayscale Area objects
int rows = frame. Rows;
int cols = frame. Cols;
Byte[,,] bgrdata= frame2. Data;
for (int i = 0; i < rows; i++)
for (int j = 0; J < cols; J + +)
{
b = Bgrdata[i, j, 0];
g = Bgrdata[i, J, 1];
R = Bgrdata[i, J, 2];
if (b < 110)
{
Bgrdata[i, j, 0] = (byte) 0;
Bgrdata[i, j, 1] = (byte) 0;
Bgrdata[i, J, 2] = (byte) 0;
}
else//two-valued
{
Bgrdata[i, j, 0] = (byte) 255;
Bgrdata[i, j, 1] = (byte) 255;
Bgrdata[i, J, 2] = (byte) 255;
}
}
pictureBox1.Image = frame2. Flip (Emgu.CV.CvEnum.FLIP.NONE). Tobitmap (); After conversion, display a binary image on the picture.