尝试修复相机
This commit is contained in:
@@ -240,10 +240,15 @@ private:
|
|||||||
{
|
{
|
||||||
if (is_open_) {
|
if (is_open_) {
|
||||||
close();
|
close();
|
||||||
|
// Wait for camera to fully release resources after close
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
}
|
}
|
||||||
|
|
||||||
FYT_INFO("camera_driver", "Opening Hik Camera Device!");
|
FYT_INFO("camera_driver", "Opening Hik Camera Device!");
|
||||||
|
|
||||||
|
// Additional wait before enumerating devices
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||||
|
|
||||||
MV_CC_DEVICE_INFO_LIST device_list;
|
MV_CC_DEVICE_INFO_LIST device_list;
|
||||||
int ret = MV_CC_EnumDevices(MV_GIGE_DEVICE | MV_USB_DEVICE, &device_list);
|
int ret = MV_CC_EnumDevices(MV_GIGE_DEVICE | MV_USB_DEVICE, &device_list);
|
||||||
if (ret != MV_OK || device_list.nDeviceNum == 0) {
|
if (ret != MV_OK || device_list.nDeviceNum == 0) {
|
||||||
@@ -321,6 +326,9 @@ private:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wait for camera to be ready after starting grabbing
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
|
||||||
is_open_ = true;
|
is_open_ = true;
|
||||||
FYT_INFO("camera_driver", "Hik Camera Device Open Success!");
|
FYT_INFO("camera_driver", "Hik Camera Device Open Success!");
|
||||||
return true;
|
return true;
|
||||||
@@ -390,7 +398,8 @@ private:
|
|||||||
ret = MV_CC_ConvertPixelType(camera_handle_, &convert_param_);
|
ret = MV_CC_ConvertPixelType(camera_handle_, &convert_param_);
|
||||||
}
|
}
|
||||||
if (ret != MV_OK) {
|
if (ret != MV_OK) {
|
||||||
FYT_WARN("camera_driver", "ConvertPixelType failed: [0x{:x}]", ret);
|
FYT_WARN("camera_driver", "ConvertPixelType failed: [0x{:x}], src_pixel_type=0x{:x}, width={}, height={}",
|
||||||
|
ret, out_frame.stFrameInfo.enPixelType, out_frame.stFrameInfo.nWidth, out_frame.stFrameInfo.nHeight);
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(camera_mutex_);
|
std::lock_guard<std::mutex> lock(camera_mutex_);
|
||||||
if (camera_handle_ != nullptr) {
|
if (camera_handle_ != nullptr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user