energy changed
This commit is contained in:
@@ -144,6 +144,7 @@ private:
|
|||||||
void showFans(std::string windows_name, const cv::Mat src);//显示扇叶
|
void showFans(std::string windows_name, const cv::Mat src);//显示扇叶
|
||||||
void showArmors(std::string windows_name, const cv::Mat src);//显示装甲板
|
void showArmors(std::string windows_name, const cv::Mat src);//显示装甲板
|
||||||
void showBoth(std::string windows_name, const cv::Mat src);//显示扇叶和装甲板
|
void showBoth(std::string windows_name, const cv::Mat src);//显示扇叶和装甲板
|
||||||
|
void showTarget(std::string windows_name, const cv::Mat src);//显示目标装甲板
|
||||||
void showCenterR(std::string windows_name, const cv::Mat src);//显示风车中心候选区R
|
void showCenterR(std::string windows_name, const cv::Mat src);//显示风车中心候选区R
|
||||||
void showFlowStrip(std::string windows_name, const cv::Mat src);//显示流动条
|
void showFlowStrip(std::string windows_name, const cv::Mat src);//显示流动条
|
||||||
void showFlowStripFan(std::string windows_name, const cv::Mat src);//显示流动条所在扇叶
|
void showFlowStripFan(std::string windows_name, const cv::Mat src);//显示流动条所在扇叶
|
||||||
|
|||||||
@@ -120,9 +120,14 @@ void Energy::runSmall(cv::Mat &gimbal_src) {
|
|||||||
if (show_process)imshow("bin", gimbal_src);
|
if (show_process)imshow("bin", gimbal_src);
|
||||||
if (findArmors(gimbal_src) < 1)return;
|
if (findArmors(gimbal_src) < 1)return;
|
||||||
if (show_energy)showArmors("armor", gimbal_src);
|
if (show_energy)showArmors("armor", gimbal_src);
|
||||||
if (!findFlowStripFan(gimbal_src))return;
|
if (!findFlowStripFan(gimbal_src)) {
|
||||||
if (!findTargetInFlowStripFan()) return;
|
if (!findFlowStripWeak(gimbal_src))return;
|
||||||
if (!findFlowStrip(gimbal_src))return;
|
} else {
|
||||||
|
if (show_energy)showFlowStripFan("strip fan", gimbal_src);
|
||||||
|
if (!findTargetInFlowStripFan()) return;
|
||||||
|
if (!findFlowStrip(gimbal_src))return;
|
||||||
|
}
|
||||||
|
if(show_energy)showTarget("target", gimbal_src);
|
||||||
|
|
||||||
// getCenter();
|
// getCenter();
|
||||||
// sendEnergy();
|
// sendEnergy();
|
||||||
|
|||||||
@@ -98,6 +98,32 @@ void Energy::showBoth(std::string windows_name, const cv::Mat src) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
// 此函数用于显示图像中目标装甲板
|
||||||
|
// ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void Energy::showTarget(std::string windows_name, const cv::Mat src) {
|
||||||
|
if (src.empty())return;
|
||||||
|
static Mat image2show;
|
||||||
|
|
||||||
|
if (src.type() == CV_8UC1) // 黑白图像
|
||||||
|
{
|
||||||
|
cvtColor(src, image2show, COLOR_GRAY2RGB);
|
||||||
|
|
||||||
|
} else if (src.type() == CV_8UC3) //RGB 彩色
|
||||||
|
{
|
||||||
|
image2show = src.clone();
|
||||||
|
}
|
||||||
|
for (const auto &armor : armors) {
|
||||||
|
if (pointDistance(armor.center, target_point) < energy_part_param_.TWIN_POINT_MAX) {
|
||||||
|
Point2f vertices[4]; //定义矩形的4个顶点
|
||||||
|
armor.points(vertices); //计算矩形的4个顶点
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
line(image2show, vertices[i], vertices[(i + 1) % 4], Scalar(255, 255, 0), 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
imshow(windows_name, image2show);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
// 此函数用于显示图像中所有可能的风车中心候选区R
|
// 此函数用于显示图像中所有可能的风车中心候选区R
|
||||||
// ---------------------------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
2
main.cpp
2
main.cpp
@@ -30,7 +30,7 @@ using namespace std;
|
|||||||
mcu_data mcuData = { // 单片机端回传结构体
|
mcu_data mcuData = { // 单片机端回传结构体
|
||||||
0, // 当前云台yaw角
|
0, // 当前云台yaw角
|
||||||
0, // 当前云台pitch角
|
0, // 当前云台pitch角
|
||||||
BIG_ENERGY_STATE, // 当前状态,自瞄-大符-小符
|
SMALL_ENERGY_STATE, // 当前状态,自瞄-大符-小符
|
||||||
0, // 云台角度标记位
|
0, // 云台角度标记位
|
||||||
1, // 是否启用数字识别
|
1, // 是否启用数字识别
|
||||||
ENEMY_RED, // 敌方颜色
|
ENEMY_RED, // 敌方颜色
|
||||||
|
|||||||
Reference in New Issue
Block a user