个人学习笔记,较简单,可供初学者参考,若有更好的方法,烦请补充~
#include<iostream>
#include<fstream>
#include<typeinfo>
#include <stdio.h>
#include <time.h>
#include <opencv2/opencv.hpp>
#include <opencv/cv.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <io.h>
using namespace std;
using namespace cv;
int main()
{
float data[4][6] = { 0 };
int i, j;
ifstream infile;/
infile.open("G:\\learning data\\testdata.txt");
for (int i = 0; i < 4; i++)//定义行循环
{
for (int j = 0; j < 6; j++)//定义列循环
{
infile >> data[i][j];//读取一个值(空格、制表符、换行隔开)就写入到矩阵中,行列不断循环进行
}
}
infile.close();
for (i = 0; i<4; i++)
for (j = 0; j<6; j++)
cout << data[i][j] << " "<< endl;
Mat img(4, 6, CV_8UC1);
uchar