|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
c++ opencv中table(1,256,CV_8UC3)更改为LUT(),通过三个通道进行显示
Mat table(1,256,CV_8UC3);
vector<Mat> bgr_planes;
split(table,bgr_planes); //通道分离,生成bgr_planesp[1],bgr_planes[2],bgr_planes[3].
uchar *p=bgr_planes[0].ptr();
merge(bgr_planes,table);
------------------------------------------------------------------------------------------------------
#include "opencv2/opencv.hpp"
using namespace std;
using namespace cv;
int main()
{
Mat table(1, 256, CV_8U);
Mat a = imread("C:\\Users\\Administrator\\Desktop\\yingxiang\\tupian\\Lenna.jpg", IMREAD_GRAYSCALE);
uchar* p = table.ptr();
for (int i = 0; i < 256; i++)
{
if (i > 100 && i <= 192)
p[i] = 0;
else
p[i] = i;
}
Mat b;
LUT(a, table, b);
imshow("NEW IMAGE", b);
waitKey(0);
return 0;
}
结合两段代码进行图片三通道显示。
跪求大神,万分感谢!!!! |
|