some refactor
This commit is contained in:
@@ -9,14 +9,11 @@
|
||||
#include <opencv2/tracking.hpp>
|
||||
#include <serial/serial.h>
|
||||
#include <armor_finder/classifier/classifier.h>
|
||||
|
||||
typedef enum{
|
||||
ENEMY_BLUE, ENEMY_RED
|
||||
} EnemyColor;
|
||||
#include "additions/additions.h"
|
||||
|
||||
class ArmorFinder{
|
||||
public:
|
||||
ArmorFinder(EnemyColor &color, Serial &u, string paras_folder, const bool &use);
|
||||
ArmorFinder(uint8_t &color, Serial &u, string paras_folder, const uint8_t &use);
|
||||
~ArmorFinder() = default;
|
||||
|
||||
private:
|
||||
@@ -26,7 +23,7 @@ private:
|
||||
SEARCHING_STATE, TRACKING_STATE, STANDBY_STATE
|
||||
} State;
|
||||
|
||||
const EnemyColor &enemy_color;
|
||||
const uint8_t &enemy_color;
|
||||
State state;
|
||||
cv::Rect2d armor_box;
|
||||
cv::Ptr<cv::Tracker> tracker;
|
||||
@@ -36,7 +33,7 @@ private:
|
||||
|
||||
int contour_area;
|
||||
Serial &serial;
|
||||
const bool &use_classifier;
|
||||
const uint8_t &use_classifier;
|
||||
|
||||
bool stateSearchingTarget(cv::Mat &src);
|
||||
bool stateTrackingTarget(cv::Mat &src);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <armor_finder/armor_finder.h>
|
||||
|
||||
ArmorFinder::ArmorFinder(EnemyColor &color, Serial &u, string paras_folder, const bool &use) :
|
||||
ArmorFinder::ArmorFinder(uint8_t &color, Serial &u, string paras_folder, const uint8_t &use) :
|
||||
serial(u),
|
||||
enemy_color(color),
|
||||
state(STANDBY_STATE),
|
||||
|
||||
@@ -21,7 +21,7 @@ static void splitBayerBG(cv::Mat &src, cv::Mat &blue, cv::Mat &red) {
|
||||
}
|
||||
}
|
||||
|
||||
void imageColorSplit(cv::Mat &src_input, cv::Mat &split, EnemyColor color) {
|
||||
void imageColorSplit(cv::Mat &src_input, cv::Mat &split, uint8_t color) {
|
||||
cv::Mat blue(240, 320, CV_8UC1), red(240, 320, CV_8UC1);
|
||||
if(src_input.type() == CV_8UC1){
|
||||
splitBayerBG(src_input, blue, red);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <opencv2/core.hpp>
|
||||
#include <armor_finder/armor_finder.h>
|
||||
|
||||
void imageColorSplit(cv::Mat &src_input, cv::Mat &split, EnemyColor color);
|
||||
void imageColorSplit(cv::Mat &src_input, cv::Mat &split, uint8_t color);
|
||||
void imagePreProcess(cv::Mat &src);
|
||||
|
||||
#endif /* _IMAGE_PROCESS_H_ */
|
||||
|
||||
Reference in New Issue
Block a user