突出图像中特定灰度范围的亮度通常是重要的,其应用包括增强特征;
灰度级分层有多种方法,基本方法有两种
代码实现:
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
Mat grayLayered(Mat srcImage)
{
Mat resultImage = srcImage.clone();
int nRows = resultImage.rows;
int nCols = resultImage.cols;
if (resultImage.isContinuous())
{
nCols = nRows*nCols;
nRows = 1;
}
uchar *pDataMat;
int controlMin = 150;
int controlMax = 200;
for (int j = 0; j <