优化项目结构
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -33,4 +33,5 @@
|
|||||||
*.app
|
*.app
|
||||||
|
|
||||||
# BUILD
|
# BUILD
|
||||||
./build/*
|
build/
|
||||||
|
.cache/
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
|
|||||||
project(armor_detector_mdv)
|
project(armor_detector_mdv)
|
||||||
|
|
||||||
# Set C++ standard
|
# Set C++ standard
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
# Find OpenCV package
|
# Find OpenCV package
|
||||||
@@ -10,21 +10,20 @@ find_package(OpenCV REQUIRED)
|
|||||||
|
|
||||||
# Include OpenCV headers
|
# Include OpenCV headers
|
||||||
include_directories(${OpenCV_INCLUDE_DIRS})
|
include_directories(${OpenCV_INCLUDE_DIRS})
|
||||||
|
include_directories(~/code/cpp/Catalyst-MDVS/inc)
|
||||||
# Include MindVision SDK headers (请根据实际SDK路径调整)
|
include_directories(/usr/include)
|
||||||
# 由于MindVision SDK在WSL中,需要在WSL环境下编译
|
include_directories(/usr/include/opencv4/opencv2/imgproc)
|
||||||
include_directories("/home/lld/mdv/include")
|
|
||||||
|
|
||||||
# Add executable for MindVision version
|
# Add executable for MindVision version
|
||||||
add_executable(armor_detector_mdv
|
add_executable(armor_detector_mdv
|
||||||
main.cpp
|
src/main.cpp
|
||||||
MindVisionCamera.cpp
|
src/MindVisionCamera.cpp
|
||||||
ImagePreprocessor.cpp
|
src/ImagePreprocessor.cpp
|
||||||
ArmorDetector.cpp
|
src/ArmorDetector.cpp
|
||||||
KalmanFilter.cpp
|
src/KalmanFilter.cpp
|
||||||
Visualizer.cpp
|
src/Visualizer.cpp
|
||||||
BallisticPredictor.cpp
|
src/BallisticPredictor.cpp
|
||||||
TTLCommunicator.cpp
|
src/TTLCommunicator.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# Link OpenCV libraries
|
# Link OpenCV libraries
|
||||||
@@ -32,7 +31,7 @@ target_link_libraries(armor_detector_mdv ${OpenCV_LIBS})
|
|||||||
|
|
||||||
# Link MindVision SDK library (路径需要根据实际情况调整)
|
# Link MindVision SDK library (路径需要根据实际情况调整)
|
||||||
# 根据提供的Makefile,库名应该是MVSDK
|
# 根据提供的Makefile,库名应该是MVSDK
|
||||||
link_directories("/home/lld/mdv/lib/x86")
|
link_directories("/lib")
|
||||||
target_link_libraries(armor_detector_mdv MVSDK)
|
target_link_libraries(armor_detector_mdv MVSDK)
|
||||||
|
|
||||||
# Additional flags for better compilation
|
# Additional flags for better compilation
|
||||||
|
|||||||
0
conanfile.txt
Normal file
0
conanfile.txt
Normal file
@@ -1,5 +1,4 @@
|
|||||||
#include "ArmorDetector.h"
|
#include "ArmorDetector.h"
|
||||||
#include <iostream>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ Camera::Camera(int cam_id, const std::string& target_color) {
|
|||||||
cap.set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'));
|
cap.set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'));
|
||||||
cap.set(cv::CAP_PROP_FRAME_WIDTH, 640);
|
cap.set(cv::CAP_PROP_FRAME_WIDTH, 640);
|
||||||
cap.set(cv::CAP_PROP_FRAME_HEIGHT, 480);
|
cap.set(cv::CAP_PROP_FRAME_HEIGHT, 480);
|
||||||
cap.set(cv::CAP_PROP_FPS, 100)
|
cap.set(cv::CAP_PROP_FPS, 100);
|
||||||
|
|
||||||
is_opened = true;
|
is_opened = true;
|
||||||
this->target_color = target_color;
|
this->target_color = target_color;
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "ImagePreprocessor.h"
|
#include "ImagePreprocessor.h"
|
||||||
#include <algorithm>
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
ImagePreprocessor::ImagePreprocessor() {
|
ImagePreprocessor::ImagePreprocessor() {
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "KalmanFilter.h"
|
#include "KalmanFilter.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
KalmanFilter::KalmanFilter() {
|
KalmanFilter::KalmanFilter() {
|
||||||
// 4 state variables (x, y, dx, dy), 2 measurements (x, y)
|
// 4 state variables (x, y, dx, dy), 2 measurements (x, y)
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <opencv2/opencv.hpp>
|
#include <opencv2/opencv.hpp>
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ void output_control_data(const cv::Point2f* ballistic_point,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_camera_resolution(MindVisionCamera& camera, int width, int height) {
|
void set_camera_resolution(MindVisionCamera& , int width, int height) {
|
||||||
// The resolution is set during camera initialization in MindVision
|
// The resolution is set during camera initialization in MindVision
|
||||||
// We need to implement a method in MindVisionCamera to change resolution
|
// We need to implement a method in MindVisionCamera to change resolution
|
||||||
// For now, we'll just log the intended change
|
// For now, we'll just log the intended change
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <opencv2/opencv.hpp>
|
#include <opencv2/opencv.hpp>
|
||||||
|
|
||||||
@@ -117,10 +116,10 @@ int main(int /*argc*/, char* /*argv*/[]) {
|
|||||||
cv::Mat frame;
|
cv::Mat frame;
|
||||||
try {
|
try {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!camera.read_frame(frame)) {
|
//if (!camera.read_frame(frame)) {
|
||||||
std::cout << "Cannot read from MindVision camera, exiting!" << std::endl;
|
// std::cout << "Cannot read from MindVision camera, exiting!" << std::endl;
|
||||||
break;
|
// break;
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Get actual image size and calculate center
|
// Get actual image size and calculate center
|
||||||
cv::Point2f img_center(frame.cols / 2.0f, frame.rows / 2.0f);
|
cv::Point2f img_center(frame.cols / 2.0f, frame.rows / 2.0f);
|
||||||
Reference in New Issue
Block a user