对于视频流获取方面新加了一个用Mindvision官方说明的获取方式,测试了代码运行是内存占用高达1G

This commit is contained in:
2025-12-02 14:22:17 +08:00
parent 241b7bc4dc
commit f833a2aa5f
3 changed files with 93 additions and 10 deletions

View File

@@ -50,18 +50,22 @@ void output_control_data(const cv::Point2f* ballistic_point,
}
}
void set_camera_resolution(MindVisionCamera& , int width, int height) {
void set_camera_resolution(MindVisionCamera& camera, int width, int height) {
// The resolution is set during camera initialization in MindVision
// We need to implement a method in MindVisionCamera to change resolution
// For now, we'll just log the intended change
std::cout << "Setting camera resolution to: " << width << "x" << height << std::endl;
if (camera.set_resolution(width, height)){
std::cout << "Successfully set camera resolution to: " << width << "x" << height << std::endl;
} else {
std::cerr << "Failed to set camera resolution to: " << width << "x" << height << std::endl;
}
}
int main(int /*argc*/, char* /*argv*/[]) {
std::string target_color = "red";
int cam_id = 0;
cv::Size default_resolution(640, 480);
bool use_ttl = true; // Set to false to disable TTL communication
bool use_ttl = false; // Set to false to disable TTL communication
// Define optional resolution list (adjust based on camera support)
std::vector<cv::Size> resolutions = {