zoukankan      html  css  js  c++  java
  • 操作MAT矩阵(转)

        t = (double)getTickCount();
        Mat img1(1000, 1000, CV_32F);
        
        for (int i=0; i<1000; i++)
        {
            for (int j=0; j<1000; j++)
            {
                img1.at<float>(i,j) = 3.2f;
            }
        }
        t = (double)getTickCount() - t;
        printf("in %gms
    ", t*1000/getTickFrequency());
        //***************************************************************
        t = (double)getTickCount();
        Mat img2(1000, 1000, CV_32F);
    
        for (int i=0; i<1000; i++)
        {
            for (int j=0; j<1000; j++)
            {
                img2.ptr<float>(i)[j] = 3.2f;
            }
        }
        t = (double)getTickCount() - t;
        printf("in %gms
    ", t*1000/getTickFrequency());
        //***************************************************************
        t = (double)getTickCount();
        Mat img3(1000, 1000, CV_32F);
        float* pData = (float*)img3.data;
    
        for (int i=0; i<1000; i++)
        {
            for (int j=0; j<1000; j++)
            {
                *(pData) = 3.2f;
                pData++;
            }
        }
        t = (double)getTickCount() - t;
        printf("in %gms
    ", t*1000/getTickFrequency());
        //***************************************************************
        t = (double)getTickCount();
        Mat img4(1000, 1000, CV_32F);
    
        for (int i=0; i<1000; i++)
        {
            for (int j=0; j<1000; j++)
            {
                ((float*)img3.data)[i*1000+j] = 3.2f;
            }
        }
        t = (double)getTickCount() - t;
        printf("in %gms
    ", t*1000/getTickFrequency());

    http://blog.csdn.net/yang_xian521/article/details/7161335

  • 相关阅读:
    安装ArcGIS Server forJava
    MyEclipse编码设置
    地图切片公式备忘
    source
    逝去的痕迹
    flex build下的svn安装
    spket安装
    flex开发一
    vs2008中的SQL Server Express访问 sql server 2005
    导入不同格式的数据到arcgis中
  • 原文地址:https://www.cnblogs.com/chchche/p/3185249.html
Copyright © 2011-2022 走看看