2011-11-24 22 views
0

假設有一幀有一些圖像。我只想顯示像素亮度高於120或130的那些部分。我怎麼用OpenCv做到這一點?有沒有任何命令可以這樣做? 然後我需要設置這些零件的強度爲190.使用opencv提高幀的某些部分的亮度

回答

1

正如astay13提到的,你可以使用threshold功能是這樣的:

Mat image = imread("someimage.jpg", 0); // flag == 0 means read as grayscale 
Mat mask; 

// this tells you where locations >= 120 pixel intensity are 
threshold(image, mask, 120.0, 255.0, THRESH_BINARY); 

// this sets those locations to 190 based on the mask you just created 
image.setTo(Scalar(190, 0, 0), mask); 
imshow("image", image); 

希望這是有幫助!

相關問題