Main:
threshold(src, dst, threshold value, max value, threshold type);
Where
src_gray: Our input image
dst: Destination (output) image
threshold_value: The thresh value with respect to which the thresholding operation is made
max_BINARY_value: The value used with the Binary thresholding operations (to set the chosen pixels)
threshold_type: One of the 5 thresholding operations.
for example,
threshold(image, fImage, 125, 255, cv::THRESH_BINARY);
means each value below 125, will be set to zero, and above 125 - 255.
If what you are looking for should have a certain range, for example, from 50 to 150, I would recommend that you make a for loop and also check and edit the pixels yourself. It is very simple. Take a look at this C ++ code:
for (int i=0; i< image.rows; i++)
{
for (int j=0; j< image.cols; j++)
{
int editValue=image.at<uchar>(i,j);
if((editValue>50)&&(editValue<150))
{
image.at<uchar>(i,j)=255;
}
else
{
image.at<uchar>(i,j)=0;
}
}
}
, . Cheers (: , .