現在,x座標を固定させy座標を40個の繰り返し文で変化させ,三角測量を行おうとしています.
最初だけ,三角測量はできるのですがループができなく
acrt_first_block==header
と表示されてしまいます.
#define NOMINMAX
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <windows.h>
#include <iostream>
#include <stdlib.h>
#include <opencv/cv.h>
#include <opencv/cxcore.h>
#include <opencv2/nonfree/nonfree.hpp>
#include <opencv2/video/video.hpp>
#include <tchar.h>
#include <opencv2/core/core.hpp>
#pragma comment(lib,"opencv_video2411d.lib")
#pragma comment (lib,"opencv_nonfree2411d.lib")
using namespace cv;
using namespace std;
int main(int argc, char *argv[]) {
//《一番目》3つのGopro画像の読み込み Mat Gopro1 = imread("lena1.png"); Mat Gopro2 = imread("lena2.png"); Mat Gopro3 = imread("lena3.png"); //《二番目》3つのGopro2次元座標の表示(※ここは固定にする。できればループでここから三角測量できるとうれしい。 vector<Point2f>Gopro1points1, Gopro1points2, Gopro1points3, Gopro1points4, Gopro1points5; vector<Point2f>Gopro2points1, Gopro2points2, Gopro2points3, Gopro2points4, Gopro2points5; float G2x1, G2y1, G2x2, G2y2, G2x3, G2y3, G2x4, G2y4, G2x5, G2y5; float G1x1, G1y1, G1x2, G1y2, G1x3, G1y3, G1x4, G1y4, G1x5, G1y5; float Ysum; Ysum = 0; vector<Point2f>Gopro1points, Gopro2points; Gopro1points.push_back(Point2f(111, 111 + Ysum)); Gopro2points.push_back(Point2f(333, 333 + Ysum)); //《三番目》三角測量 for (int i = 0; i < 40; i++) { Gopro1points.push_back(Point2f(111, 111 + Ysum)); Gopro2point.push_back(Point2f(333, 333 + Ysum)); G1x1 = Gopro1points[0].x; G1y1 = Gopro1points[0].y; cout << "Gopro1のpoint1による注目座標=" << "[" << G1x1 << "," << G1y1 << "]" << endl; G2x1 = Gopro2points[0].x; G2y1 = Gopro2points[0].y; cout << "Gopro2のpoints1による注目座標=" << "[" <<G2x1 << "," << G2y1 << "]" << endl; //パターン2:Gopro1-Gopro2 //カメラ間の推定基準長は111mmであった為 float hbi = 7700; //ここはカメラ校正時の値なのでhbi以外は同じ Mat cameraMatrixL2 = (Mat_<float>(3, 4) << 173, 0, 198, hbi * 173, 0, 173, 150, 0, 0, 0, 1, 0 ); Mat cameraMatrixR2 = (Mat_<float>(3, 4) << 173, 0, 198, -hbi * 173, 0, 173, 150, 0, 0, 0, 1, 0 ); Mat points4D2; vector<Point3f>points3D2; triangulatePoints(cameraMatrixL2, cameraMatrixR2, Mat(Gopro1points), Mat(Gopro2points), points4D2); convertPointsFromHomogeneous(points4D2.reshape(4, 1), points3D2); cout << "パターン1:Gopro1-Gopro2における三次元座標" << points3D2[i] << endl; cout << "-------------------------" << endl; Ysum = 200 *( i+1); }
回答1件
あなたの回答
tips
プレビュー