Merge energe.

This commit is contained in:
xinyang
2019-07-06 20:25:36 +08:00
parent 1abe8dec17
commit 0ffec961da
3 changed files with 4 additions and 7 deletions

View File

@@ -29,8 +29,8 @@ void ArmorFinder::run(cv::Mat &src) {
showArmorBox("box", src, armor_box, boxid); showArmorBox("box", src, armor_box, boxid);
cv::waitKey(1); cv::waitKey(1);
} }
stateSearchingTarget(src_use); // stateSearchingTarget(src_use);
return; // return;
switch (state){ switch (state){
case SEARCHING_STATE: case SEARCHING_STATE:
if(stateSearchingTarget(src_use)){ if(stateSearchingTarget(src_use)){

View File

@@ -129,7 +129,6 @@ static bool findLightBlobs(const cv::Mat &src, LightBlobs &light_blobs) {
}else if(src.type() == CV_8UC1){ }else if(src.type() == CV_8UC1){
src_gray = src.clone(); src_gray = src.clone();
} }
LightBlobs all;
std::vector<std::vector<cv::Point> > light_contours; std::vector<std::vector<cv::Point> > light_contours;
cv::findContours(src_gray, light_contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE); cv::findContours(src_gray, light_contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);
@@ -138,9 +137,7 @@ static bool findLightBlobs(const cv::Mat &src, LightBlobs &light_blobs) {
if(isValidLightBlob(src_gray, rect)){ if(isValidLightBlob(src_gray, rect)){
light_blobs.emplace_back(rect); light_blobs.emplace_back(rect);
} }
all.emplace_back(rect);
} }
showContours("all", src, all);
return light_blobs.size() >= 2; return light_blobs.size() >= 2;
} }

View File

@@ -29,7 +29,7 @@ mcu_data mcuData = {
ARMOR_STATE, ARMOR_STATE,
0, 0,
1, 1,
ENEMY_RED, ENEMY_BLUE,
}; };
WrapperHead *video_gimble = nullptr; WrapperHead *video_gimble = nullptr;
@@ -110,7 +110,7 @@ int main(int argc, char *argv[]) {
if (show_origin) showOrigin(gimble_src); if (show_origin) showOrigin(gimble_src);
if (mcuData.state == ARMOR_STATE){ if (mcuData.state == ARMOR_STATE){
CNT_TIME("Armor Time", { CNT_TIME("Armor Time", {
armorFinder.run(gimble_src); armorFinder.run(gimble_src);
}); });
} }
else if(mcuData.state == SMALL_ENERGY_STATE){ else if(mcuData.state == SMALL_ENERGY_STATE){