我試圖找出框架的某些區域,該框架位於Ycbcr色彩空間中。我必須根據它們的Y值來選擇這些區域。在某些像素上繪製矩形openCV
所以我寫了這個代碼:
Mat frame. ychannel;
VideoCapture cap(1);
int key =0;
int maxV , minV;
Point max, min;
while(key != 27){
cap >> frame;
cvtColor(frame,yframe,CV_RGB_YCrCb); // converting to YCbCr color space
extractChannel(yframe, yframe, 0); // extracting the Y channel
cv::minMaxLoc(yframe,&minV,&maxV,&min,&max);
cv::threshold(outf,outf,(maxV-10),(maxV),CV_THRESH_TOZERO);
/**
Now I want to use :
cv::rectangle()
but I want to draw a rect around any pixel (see the picture bellow)that's higher than (maxV-10)
and that during the streaming
**/
key = waitKey(1);
}
我畫這幅畫跳躍,它有助於瞭解什麼我做什麼。
感謝您的幫助。
謝謝你回答阿迪,但你能解釋嗎? – Engine
鏈接是OpenCV的findContours()函數。 @Chris拼出來了。 –