OpenCV数字图像处理十:读写txt文件,在图像训练和测试的时候经常用到

来源:互联网 发布:windows license 编辑:程序博客网 时间:2024/05/17 04:28
#include <cv.h>#include <highgui.h>#include <cvaux.h>using namespace std;using namespace cv;bool showSteps = true;bool writeModel = true;bool saveRegions = true;#define dataNum ( 4381 )int main(){FILE *fp;int i,j;if( ( fp=fopen("C:\\Temp\\negtives\\neg.txt","r") )==NULL ){printf("can not open the file\n");exit(0);}char *fileName = NULL;fileName = (char *)malloc(dataNum*sizeof(char));for(i=0;i<dataNum;i++){//读取一行fscanf(fp,"%s\n",fileName);cout<<fileName<<endl;} fclose(fp);waitKey(0); }