-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimpledemo.cpp
36 lines (30 loc) · 1.01 KB
/
simpledemo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "simpledemo.h"
SimpleDemo::SimpleDemo()
{
}
SimpleDemo::SimpleDemo(std::vector<Point3f> &points){
demoImg=cv::imread("/home/cvpr/xcz/stereoMatching/UI/stereo/dst2.png");
for(int i=0;i<points.size();i++){
D3points.push_back(points[i]);
}
}
void SimpleDemo::showDemo(){
for(int i=0;i<D3points.size();i++){
int x=D3points[i].x;
int y=D3points[i].y;
int z=D3points[i].z;
string outputText=SimpleDemo::Int2String(int(x))+","+SimpleDemo::Int2String(int(y))+","+SimpleDemo::Int2String(int(z));
cv::circle(demoImg,Point(int(x+500)/4,int(500-z*8)),8,CV_RGB(0,0,0),2);
cv::putText(demoImg, outputText, Point(int(x+500)/4,int(500-z*8)), 0, 1, Scalar(0,0,0),1);
}
line(demoImg,Point(0,450),Point(500,450),Scalar(0,0,255),2);
line(demoImg,Point(250,0),Point(250,500),Scalar(0,0,255),2);
}
Mat SimpleDemo::getDemo(){
return demoImg;
}
string SimpleDemo::Int2String(int num){
ostringstream stream;
stream<<num;
return stream.str();
}