try fix gray

This commit is contained in:
cyy_mac
2026-03-28 05:07:34 +08:00
parent cb59f59277
commit d3e79f4103

View File

@@ -282,7 +282,21 @@ private:
// Set pixel format to RGB8 (try to force color output)
// PixelType_Gvsp_RGB8_Packed = 0x02100014
(void)MV_CC_SetEnumValue(camera_handle_, "PixelFormat", PixelType_Gvsp_RGB8_Packed);
int set_ret = MV_CC_SetEnumValue(camera_handle_, "PixelFormat", PixelType_Gvsp_RGB8_Packed);
if (set_ret != MV_OK) {
FYT_WARN("camera_driver", "Failed to set PixelFormat to RGB8: [0x{:x}]", set_ret);
} else {
FYT_INFO("camera_driver", "PixelFormat set to RGB8");
}
// Wait for pixel format to take effect
std::this_thread::sleep_for(std::chrono::milliseconds(100));
// Verify pixel format
MVCC_ENUMVALUE enum_value = {0};
if (MV_CC_GetEnumValue(camera_handle_, "PixelFormat", &enum_value) == MV_OK) {
FYT_INFO("camera_driver", "Current PixelFormat: 0x{:x}", enum_value.nCurValue);
}
// Set exposure / gain
(void)MV_CC_SetFloatValue(camera_handle_, "ExposureTime", static_cast<float>(exposure_time_));