zoukankan      html  css  js  c++  java
  • 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;
    }

  • 相关阅读:
    动态加载并执行Win32可执行程序
    二维码登录
    深度神经网络实现图像理解的原理
    NET Core Docker部署
    EventStore的设计思路
    NET Core,Ubuntu运行
    Tensorflow 神经网络
    System.Reflection.Emit学习
    泛型 "new的性能"
    蚁群算法
  • 原文地址:https://www.cnblogs.com/mintmy/p/4108378.html
Copyright © 2011-2022 走看看