代码拉取完成,页面将自动刷新
同步操作将从 Sherry/SAS视觉 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "Armor/Armor.hpp"
#include "AngleSolver/AngleSolver.hpp"
//#include "Serial/sendDataToSTM.h"
#include "opencv2/core/core.hpp"
#include <iostream>
using namespace cv;
using namespace std;
ArmorDetector newDetector;
vector<Point2f> contourPoints;
Point2f centerPoint;
ArmorType type;
AngleSolver newSolver;
float yaw, pitch, r;
int main() {
newDetector.setTargetNum(1);
newDetector.loadSVM("../Armor/123svm.xml");
Mat src;
string FileName;
for(int i = 1; i <= 96953; i++) {
//if(!(i % 100)) cout << i << endl;
FileName = "rmcvdata/roco_train/";
FileName += i / 10000000 + '0';
FileName += i / 1000000 % 10 + '0';
FileName += i / 100000 % 10 + '0';
FileName += i / 10000 % 10 + '0';
FileName += i / 1000 % 10 + '0';
FileName += i / 100 % 10 + '0';
FileName += i / 10 % 10 + '0';
FileName += i % 10 + '0';
FileName += ".jpg";
//FileName = "test.jpg";
src = imread(samples::findFile(FileName), IMREAD_COLOR);
if(src.empty()) {
cout << "file " + FileName + " not found!\n";
continue;
}
cout << i << endl;
cout << endl << endl << "--RED---RED---RED---RED---RED---RED---RED---RED--" << endl;
newDetector.setEnemyColor(RED);
newDetector.run(src);
newDetector.showDebugInfo(1, 1, 1, 1, 1, 1, 1);
if(newDetector.isFoundArmor())
{
newDetector.getTargetInfo(contourPoints, centerPoint, type);
newSolver.solve(contourPoints, centerPoint, src.size(), yaw, pitch, r);
cout << "Solved: " << yaw << " " << pitch << " " << r << endl;
//sendTargetData(pitch, yaw, r, COLOR_RED, 1);
}
//else sendTargetData(0.0f, 0.0f, 0.0f, COLOR_RED, 0);
waitKey(0);
cout << endl << endl << "--BLUE--BLUE--BLUE--BLUE--BLUE--BLUE--BLUE--BLUE-" << endl;
newDetector.setEnemyColor(BLUE);
newDetector.run(src);
newDetector.showDebugInfo(1, 1, 1, 1, 1, 1, 1);
if(newDetector.isFoundArmor())
{
newDetector.getTargetInfo(contourPoints, centerPoint, type);
newSolver.solve(contourPoints, centerPoint, src.size(), yaw, pitch, r);
cout << "Solved: " << yaw << " " << pitch << " " << r << endl;
//sendTargetData(pitch, yaw, r, COLOR_BLUE, 1);
}
//else sendTargetData(0.0f, 0.0f, 0.0f, COLOR_BLUE, 0);
waitKey(0);
}
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。