• opencv学习


    使用查找表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;
    }

  • 相关阅读:
    selenium自动化测试实战——12306铁路官网范例
    mock接口开发——flask模块
    python调用接口——requests模块
    python操作redis
    python修改excel内容
    python读excel
    python发送邮件
    python写日志
    python的模块
    python写excel
  • 原文地址:https://www.cnblogs.com/mintmy/p/4108378.html
Copyright © 2020-2023  润新知