This commit is contained in:
JiatongSun
2019-04-28 13:08:32 +08:00
parent c2b4bdf4cd
commit 2dad2d864a
4 changed files with 13 additions and 13 deletions

View File

@@ -19,7 +19,7 @@ int Energy::findFan(const cv::Mat &src, vector<EnergyPart> &fans, int &last_fans
std::vector<vector<Point> > fan_contours;
StructingElementClose(src_bin);
imshow("fan struct",src_bin);
// imshow("fan struct",src_bin);
findContours(src_bin, fan_contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);

View File

@@ -12,14 +12,14 @@ extern float curr_yaw, curr_pitch, mark_yaw, mark_pitch;
extern int mark;
int Energy::run(cv::Mat &src){
imshow("src",src);
// imshow("src",src);
fans.clear();
armors.clear();
fanPosition.clear();
armorPosition.clear();
gimble_zero_points.clear();
// if(mark==0)return 0;
if(mark==0)return 0;
// if(all_armor_centers.size()>200)all_armor_centers.clear();
// if(first_armor_centers.size()>200)first_armor_centers.clear();
@@ -51,8 +51,8 @@ int Energy::run(cv::Mat &src){
cout<<"all_armor_centers.size(): "<<all_armor_centers.size()<<endl;
cycleLeastFit();
cycle_center = cv::Point(321,319);
radius = 109.178;
cycle_center = cv::Point(214,305);
radius = 114.695;
attack_distance = ATTACK_DISTANCE * 123.323 / radius;
getFanPosition(fanPosition, fans, cycle_center, radius);
@@ -62,11 +62,11 @@ int Energy::run(cv::Mat &src){
cout<<"The target armor center is: "<<target_center<<endl;
getHitPoint();
// hit_point = target_center;
hit_point = target_center;
cout << "The hit point position is " << hit_point << endl;
// hit_point = cycle_center;
if(!isSendTarget)return 0;
// if(!isSendTarget)return 0;
gimbleRotation();

View File

@@ -119,7 +119,7 @@ void uartReceive(Uart* uart){
}
memcpy(&curr_yaw, buffer, 4);
memcpy(&curr_pitch, buffer+4, 4);
LOGM("Get yaw:%f pitch:%f", curr_yaw, curr_pitch);
// LOGM("Get yaw:%f pitch:%f", curr_yaw, curr_pitch);
if(buffer[9] == 1){
if(mark == 0){
mark = 1;

View File

@@ -97,12 +97,14 @@ bool CameraWrapper::init() {
CameraSetAnalogGain(h_camera, 63);
// 使用预设LUT表
CameraSetLutMode(h_camera, LUTMODE_PRESET);
// 抗频闪
// CameraSetAntiFlick(h_camera, true);
}
else if(mode == 1){
// 使用自动曝光
CameraSetAeState(h_camera, true);
// 抗频闪
// CameraSetAntiFlick(h_camera, true);
CameraSetAntiFlick(h_camera, true);
}
/*让SDK进入工作模式开始接收来自相机发送的图像
@@ -117,9 +119,6 @@ bool CameraWrapper::init() {
CameraGetFriendlyName CameraSetFriendlyName 获取/设置相机名称(该名称可写入相机硬件)
*/
// 抗频闪
// CameraSetAntiFlick(h_camera, true);
if (tCapability.sIspCapacity.bMonoSensor) {
channel = 1;
CameraSetIspOutFormat(h_camera, CAMERA_MEDIA_TYPE_MONO8);
@@ -135,7 +134,8 @@ bool CameraWrapper::init() {
bool CameraWrapper::read(cv::Mat& src) {
// return readRaw(src); //suit for using bayer hacking in armor_finder to replace process, fast and it can filter red and blue.
return readProcessed(src); // processed color image, but this runs slowly, about half fps of previous one.
if(mode==0)return readProcessed(src); // processed color image, but this runs slowly, about half fps of previous one.
if(mode==1)return readRaw(src);
}