首页 > 学院 > 开发设计 > 正文

单通道下读入和输出一个矩阵

2019-11-08 02:18:20
字体:
来源:转载
供稿:网友
#include<iostream> #include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp> using namespace cv;  int main( int argc, char** argv ){    float  a[18] = {         30,60,45,56,70,78,         90,80,94,89,87,91,    78,76,56,43,21,10 };                                                              CvMat mat;      cvInitMatHeader(&mat,3, 3, CV_32FC2,a);  //创建一个空矩阵    for(int y = 0; y <mat.rows; y++)      {         for(int x = 0; x <mat.cols; x++)         {  float  value = cvGetReal2D(&mat, y, x);  PRintf("%f",value);       }    printf("/n");}return 0; }
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表