c++读取与写入
来源:互联网 发布:淘宝购买数量点到1000 编辑:程序博客网 时间:2024/05/17 03:26
#include <iostream>
#include <fstream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/ml/ml.hpp>
using namespace std;
using namespace cv;
int a,b,c,d,e;
int width,height;
char str3[25];
long long save_num=0;
Mat rect;
Mat src;
int num1=0;
string pattern=" ";
vector< string> split( string str, string pattern)
{
vector<string> ret;
if(pattern.empty()) return ret;
size_t start=0,index=str.find_first_of(pattern,0);
while(index!=str.npos)
{
if(start!=index)
ret.push_back(str.substr(start,index-start));
start=index+1;
index=str.find_first_of(pattern,start);
}
if(!str.substr(start).empty())
ret.push_back(str.substr(start));
return ret;
}
void main()
{
ifstream in("C:/Users/Administrator/Desktop/pos/thumbResults_nothumb.txt");
ofstream out("C:/Users/Administrator/Desktop/pos/thumbResults_nothumb1.txt");
in.eof();
//依次读取正样本图片,生成HOG描述子
for(string s;getline(in,s);) //getline函数只能用于ifstream
{
//num1++;
vector<string> result=split(s,pattern);
src=imread(result[0]);
cout<<"处理正样本:"<<result[0]<<endl;
a=atoi(result[2].c_str());
b=atoi(result[3].c_str());
c=atoi(result[4].c_str());
d=atoi(result[5].c_str());
width=c-a;
height=d-b;
result[3]=itoa(cvRound(0.3*double(height))+b,str3,10);
out<<result[0]<<" "<<"1"<<" "<<result[2]<<" "<<result[3]<<" "<<result[4]<<" "<<result[5]<<endl;
}
}
#include <fstream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/ml/ml.hpp>
using namespace std;
using namespace cv;
int a,b,c,d,e;
int width,height;
char str3[25];
long long save_num=0;
Mat rect;
Mat src;
int num1=0;
string pattern=" ";
vector< string> split( string str, string pattern)
{
vector<string> ret;
if(pattern.empty()) return ret;
size_t start=0,index=str.find_first_of(pattern,0);
while(index!=str.npos)
{
if(start!=index)
ret.push_back(str.substr(start,index-start));
start=index+1;
index=str.find_first_of(pattern,start);
}
if(!str.substr(start).empty())
ret.push_back(str.substr(start));
return ret;
}
void main()
{
ifstream in("C:/Users/Administrator/Desktop/pos/thumbResults_nothumb.txt");
ofstream out("C:/Users/Administrator/Desktop/pos/thumbResults_nothumb1.txt");
in.eof();
//依次读取正样本图片,生成HOG描述子
for(string s;getline(in,s);) //getline函数只能用于ifstream
{
//num1++;
vector<string> result=split(s,pattern);
src=imread(result[0]);
cout<<"处理正样本:"<<result[0]<<endl;
a=atoi(result[2].c_str());
b=atoi(result[3].c_str());
c=atoi(result[4].c_str());
d=atoi(result[5].c_str());
width=c-a;
height=d-b;
result[3]=itoa(cvRound(0.3*double(height))+b,str3,10);
out<<result[0]<<" "<<"1"<<" "<<result[2]<<" "<<result[3]<<" "<<result[4]<<" "<<result[5]<<endl;
}
}
0 0
- c#excel文件的读取与写入
- 【C++】文件的读取与写入
- 【C#】关于文件的写入与读取
- C/C++读取与写入文件
- 【C++】文件的读取与写入
- 写入与读取
- KissXML 读取与写入
- 读取与写入
- 读取与写入文件
- properties读取与写入
- 读取与写入Cache
- c++读取与写入
- matlab写入二进制文件与C语言读取二进制文件
- 【C#】对文本、图片、音频文件的读取与写入
- C语言的文件读取与写入操作
- C语言/C++文件的读取与写入操作
- c语言对结构体的读取与写入
- C#cookies写入,读取事例
- Spring Boot工程结构(推荐)
- Ubuntu设置与修改用户密码
- echo中如何换行
- JAVA 中BIO,NIO,AIO的理解
- (提高篇) 第七讲 编程项目 k次方之和 大赛计分器等
- c++读取与写入
- 安卓安全实践
- 录音文件的导出
- JSP 用户提交请求
- vaadin插件安装方法eclipse
- LoadLayout快速实现加载中界面,加载错误界面,空界面等功能
- 多线程之synchronized(this)
- 并查集(DSU)
- [Lintcode]Maximum Product Subarray乘积最大子序列