标签:des io ar color os 使用 sp for on
使用查找表LUT
#include <cv.h>
#include <highgui.h>
#include <stdio.h>
using namespace std;
using namespace cv;
int main(int argc, char **argv)
{
double t = (double)getTickCount();
const char *srcfile = argv[1];
Mat srcimg;
srcimg = imread(srcfile, CV_LOAD_IMAGE_COLOR);
namedWindow("foggy", CV_WINDOW_AUTOSIZE);
imshow("foggy", srcimg);
//waitKey(0);
uchar r = 7;
Mat mask = Mat::ones(2 * r + 1, 2 * r + 1, CV_8UC1);
uchar nc = srcimg.channels(), nrows = srcimg.rows, ncols = srcimg.cols*nc,i,j;
if (srcimg.isContinuous())
{
ncols *= nrows;
nrows = 1;
}
Mat lookUpTable(1, 256, CV_8U);
uchar *p = lookUpTable.data;
for (int i = 0; i < 256; ++i)
p[i] = i / 32 * 32;
Mat des;
LUT(srcimg, lookUpTable, des);
namedWindow("out", CV_WINDOW_AUTOSIZE);
imshow("out", des);
waitKey(0);
/*MatIterator_<Vec3b> it, end;
for (it = srcimg.begin<Vec3b>(), end = srcimg.end<Vec3b>(); it != end; ++it)
{
(*it)[0]=
}
*/
t = ((double)getTickCount() - t) / getTickFrequency();
cout << "Time passed in seconds :" << t << endl;
return 0;
}
标签:des io ar color os 使用 sp for on
原文地址:http://www.cnblogs.com/mintmy/p/4108378.html