DPM样本生成——字符转换
来源:互联网 发布:淘宝天猫京东 编辑:程序博客网 时间:2024/05/23 15:40
// DPMSample.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
using namespace std;
using namespace cv;
vector<string> split(string str,string pattern);
int _tmain(int argc, _TCHAR* argv[])
{
ifstream data("list.txt");
ofstream new_txt;
new_txt.open("DATA-MODEL-all.txt",ios::app|ios::out);
string buf;
while(data)
{
if(getline(data,buf))
{
Mat img;
img=imread(buf);
char result[500];
sprintf(result,"%d %d %d %d %s",1,1,img.cols-1,img.rows-1,buf.c_str());
new_txt<<result<<endl;
}
}
new_txt.close();
return 0;
}
//字符串分割函数//
vector<string> split(string str,string pattern)
{
string::size_type pos;
vector<string> result;
str+=pattern;//扩展字符串以方便操作//
int size=str.size();
for(int i=0; i<size; i++)
{
pos=str.find(pattern,i);
if(pos<size)
{
string s=str.substr(i,pos-i);
result.push_back(s);
i=pos+pattern.size()-1;
}
}
return result;
}
//
#include "stdafx.h"
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
using namespace std;
using namespace cv;
vector<string> split(string str,string pattern);
int _tmain(int argc, _TCHAR* argv[])
{
ifstream data("list.txt");
ofstream new_txt;
new_txt.open("DATA-MODEL-all.txt",ios::app|ios::out);
string buf;
while(data)
{
if(getline(data,buf))
{
Mat img;
img=imread(buf);
char result[500];
sprintf(result,"%d %d %d %d %s",1,1,img.cols-1,img.rows-1,buf.c_str());
new_txt<<result<<endl;
}
}
new_txt.close();
return 0;
}
//字符串分割函数//
vector<string> split(string str,string pattern)
{
string::size_type pos;
vector<string> result;
str+=pattern;//扩展字符串以方便操作//
int size=str.size();
for(int i=0; i<size; i++)
{
pos=str.find(pattern,i);
if(pos<size)
{
string s=str.substr(i,pos-i);
result.push_back(s);
i=pos+pattern.size()-1;
}
}
return result;
}
0 0
- DPM样本生成——字符转换
- Tesseract-OCR 字符识别——样本训练 [转]
- 特征提取——生成样本矩阵(MATLAB实现)
- DPM——检测源码分析
- DPM——训练源码分析
- 字符—数字转换
- 自动切割图像——负样本自动生成代码 C++
- 人脸检测——mtcnn思想,生成negative、positive、part样本。
- 用matlab生成样本
- DPM
- DPM
- DPM
- DPM
- 字符串——字符转换
- Linux电源管理研究笔记—动态电源管理(DPM)
- Linux电源管理研究笔记—动态电源管理(DPM)
- Linux电源管理研究笔记—动态电源管理(DPM)
- Linux电源管理研究笔记—动态电源管理(DPM)
- Android、IOS和windows phone三个主流平台分辨率大全
- iOS检测版本更新
- cocos2d-x动作游戏的小技术点
- 如果maven中使用markdown生成xml需要添加插件
- Servlet、Filter、Listener的简介
- DPM样本生成——字符转换
- mysql下载
- 关于UPNP开发的基础实现步骤
- UVA 10483 - The Sum Equals the Product (枚举技巧)
- 设计模式实战之——创建型模式(Builder、Factory method、Abstract factory)
- 黑马程序员_交通灯管理系统项目
- C运算符优先级
- Linux SVN 用户名密码清除
- Android通过ant脚本打包带Library project的方法