energy changed
This commit is contained in:
@@ -144,6 +144,7 @@ private:
|
||||
void showFans(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 showTarget(std::string windows_name, const cv::Mat src);//显示目标装甲板
|
||||
void showCenterR(std::string windows_name, const cv::Mat src);//显示风车中心候选区R
|
||||
void showFlowStrip(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 (findArmors(gimbal_src) < 1)return;
|
||||
if (show_energy)showArmors("armor", gimbal_src);
|
||||
if (!findFlowStripFan(gimbal_src))return;
|
||||
if (!findTargetInFlowStripFan()) return;
|
||||
if (!findFlowStrip(gimbal_src))return;
|
||||
if (!findFlowStripFan(gimbal_src)) {
|
||||
if (!findFlowStripWeak(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();
|
||||
// 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
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user