Home > Software engineering >  What is the program ideas
What is the program ideas

Time:09-23

CodePudding user response:

Baidu search relevant keywords,

CodePudding user response:

S and T are calculated respectively in the distance of any two points, and determine whether equal (error is less than the delta)

CodePudding user response:

#include
#include
#include
#include
#include
#include
//# include "Windef. H"
# include "opencv2/calib3d/calib3d HPP"
#include
//# include "opencv2/imgcodecs HPP"
using namespace std;
Using the namespace CV;
//bool CMP (int * p, int * q)
//{
//if (p=q [0]=[0])
//{
//if (p==q [1] [1])
//{
//return p [2] //}
//else return p [1] //}
//else return p [0] //}
Int findMax (vector Vec) {
Int Max=- 999;
For (auto v: vec) {
If (Max & lt; V) Max=v;
}
return max;
}
Int main () {
//import 3 d data
VectorIfstream infile (pl. TXT ");
if (! Infile) {cout & lt; <"LinePoint - L6. TXT! "& lt; Double x, y;
While (infile & gt;> X & gt;> Y)
{
Points1. Push_back (CV: : Point2d (x, y));
}

Ifstream infile1 (" pr. TXT ");
if (! Infile1) {cout & lt; <"LinePoint - R6. TXT! "& lt; Double x1, y1.
While (infile1 & gt;> The x1 & gt;> Y1)
{
Points2. Push_back (CV: : Point2d (x1, y1));
}

//3 d matching
Vector Dis_3dv;//points11 midpoint distance
Vector Dis1_3dv;//points21 midpoint distance

Dis_3d=new double double * * * [13].
Dis1_3d=new double double * * * [13].
//double dis_3d [13] [13].
//double dis1_3d [13] [13].

for (int i=0; I & lt; Points1. The size (); I++)
{
Double a=points1 [I]. X;
Double b=points1 [I] y;
//double c=points11 [I] z;
Double a1=points2 [I]. X;
Double b1=points2 [I] y;
//double c1=points21 [I] z;
Dis_3d [I]=new double [13].
Dis1_3d [I]=new double [13].
For (int j=0; J & lt; Points2. The size () & amp; & J!=I; J++)
{
//the coordinates of point
Double x=points1 [j]. Journal of x;
Double y=points1 [j]. J y;
//double z=points11 [j]. J z;

Double x1=points2 [j]. Journal of x;
Double y1=points2 [j]. J y;
//double z1=points21 [j]. J z;

//calculate the distance the point-to-point
//dis_3d. Push_back (SQRT ((a - x) * (a - x) + (b - y) * (b - y)));
//dis1_3d. Push_back (SQRT ((a1 - x1) * (a1 - x1) + (b1 - y1) * (b1 - y1)));

Dis_3d [I] [j]=SQRT (a - (x) * (a - x) + (b - y) * (b - y));
Dis1_3d [I] [j]=SQRT ((a1 - x1) * (a1 - x1) + (b1 - y1) * (b1 - y1));
//dis1_3d [I] [j]=SQRT ((a1 - x1) * (a1 - x1) + (b1 - y1) * (b1 - y1));
//cout & lt; //dis_3d. Push_back (SQRT ((a - x) * (a - x) + (b - y) * (b) y + z (c) * (c - z)));
Sort (dis_3d dis_3d + 13);
Sort (dis1_3d dis1_3d + 13);
cout }
}

//cout & lt; //vector array

Vector The Match;//store matching
//double dis [15] [15].
For (int m=0; M & lt; Points1. The size (); M++) {
for (int i=0; I & lt; Points1. The size (); I++) {
Vector Dis.//storage of the distance between the two different points difference
For (int j=0; J & lt; Points2. The size (); J++) {
//calculation of the distance between the point set difference
//sort (dis_3d [j], [I] dis_3d [I] [j] + 15);
Dis. Push_back (fabs (dis_3d [m] [j] - dis1_3d [I] [j]));
//cout & lt; }

The storage of the matching point//
Double maxNumber=findMax (dis);
cout A double threshold=- 22;
If (maxNumber & lt; Threshold)
{
//the location in which the minimum distance of the corresponding
Match. The push_back (I);
}
}
//Match1. Push_back (Point (m, Match [I]));
}
cout System (" pause ");
}

Where is my program way of thinking was wrong

CodePudding user response:

1, cycle does not need to start from 0, difference only need to compute the distance
For (int m=0; M & lt; Points1. The size (); M++) {
For (int I= m +; I & lt; Points1. The size (); I++)

2, should not need to save the distance value

If (d1, d2 & gt; Delta)
return false;//d1, d2 respectively, S, T set of I, the distance between the j point difference, found that distance does not match is returned, not need to continue to calculate

CodePudding user response:

Hello convenient leave your contact information, please I ask you for a moment, thanks
  • Related