add eHDR controls
This commit is contained in:
@@ -74,6 +74,18 @@ std::string CameraController::processCommand(const std::string& jsonCommand) {
|
||||
return handleStopStream();
|
||||
} else if (command == "set_pipeline") {
|
||||
return handleSetPipeline(getParam("pipeline"));
|
||||
} else if (command == "set_ehdr_mode") {
|
||||
return handleSetEHDRMode(getParam("mode"));
|
||||
} else if (command == "set_ehdr_exposure_min") {
|
||||
return handleSetEHDRExposureMin(getParam("value"));
|
||||
} else if (command == "set_ehdr_exposure_max") {
|
||||
return handleSetEHDRExposureMax(getParam("value"));
|
||||
} else if (command == "set_ehdr_ratio_min") {
|
||||
return handleSetEHDRRatioMin(getParam("value"));
|
||||
} else if (command == "set_ehdr_ratio_max") {
|
||||
return handleSetEHDRRatioMax(getParam("value"));
|
||||
} else if (command == "get_ehdr_status") {
|
||||
return handleGetEHDRStatus();
|
||||
} else {
|
||||
return createErrorResponse("Unknown command: " + command);
|
||||
}
|
||||
@@ -233,6 +245,89 @@ std::string CameraController::handleSetGain(const std::string& value) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string CameraController::handleSetEHDRMode(const std::string& value) {
|
||||
try {
|
||||
const int mode = std::stoi(value);
|
||||
if (VxSetISPImageProcessing(camera_, VX_ISP_IMAGE_PROPERTIES::ISP_IMAGE_EHDR_MODE, mode) != 0) {
|
||||
return createErrorResponse("Failed to set eHDR mode");
|
||||
}
|
||||
return createSuccessResponse("eHDR mode set successfully");
|
||||
} catch (const std::exception& e) {
|
||||
return createErrorResponse(std::string("Invalid parameters: ") + e.what());
|
||||
}
|
||||
}
|
||||
|
||||
std::string CameraController::handleSetEHDRExposureMin(const std::string& value) {
|
||||
try {
|
||||
const int minExp = std::stoi(value);
|
||||
if (VxSetISPImageProcessing(camera_, VX_ISP_IMAGE_PROPERTIES::ISP_EHDR_EXPOSURE_MIN_NUMBER, minExp) != 0) {
|
||||
return createErrorResponse("Failed to set eHDR exposure min");
|
||||
}
|
||||
return createSuccessResponse("eHDR exposure min set successfully");
|
||||
} catch (const std::exception& e) {
|
||||
return createErrorResponse(std::string("Invalid parameters: ") + e.what());
|
||||
}
|
||||
}
|
||||
|
||||
std::string CameraController::handleSetEHDRExposureMax(const std::string& value) {
|
||||
try {
|
||||
const int maxExp = std::stoi(value);
|
||||
if (VxSetISPImageProcessing(camera_, VX_ISP_IMAGE_PROPERTIES::ISP_EHDR_EXPOSURE_MAX_NUMBER, maxExp) != 0) {
|
||||
return createErrorResponse("Failed to set eHDR exposure max");
|
||||
}
|
||||
return createSuccessResponse("eHDR exposure max set successfully");
|
||||
} catch (const std::exception& e) {
|
||||
return createErrorResponse(std::string("Invalid parameters: ") + e.what());
|
||||
}
|
||||
}
|
||||
|
||||
std::string CameraController::handleSetEHDRRatioMin(const std::string& value) {
|
||||
try {
|
||||
const int minRatio = std::stoi(value);
|
||||
if (VxSetISPImageProcessing(camera_, VX_ISP_IMAGE_PROPERTIES::ISP_EHDR_RATIO_MIN, minRatio) != 0) {
|
||||
return createErrorResponse("Failed to set eHDR ratio min");
|
||||
}
|
||||
return createSuccessResponse("eHDR ratio min set successfully");
|
||||
} catch (const std::exception& e) {
|
||||
return createErrorResponse(std::string("Invalid parameters: ") + e.what());
|
||||
}
|
||||
}
|
||||
|
||||
std::string CameraController::handleSetEHDRRatioMax(const std::string& value) {
|
||||
try {
|
||||
const int maxRatio = std::stoi(value);
|
||||
if (VxSetISPImageProcessing(camera_, VX_ISP_IMAGE_PROPERTIES::ISP_EHDR_RATIO_MAX, maxRatio) != 0) {
|
||||
return createErrorResponse("Failed to set eHDR ratio max");
|
||||
}
|
||||
return createSuccessResponse("eHDR ratio max set successfully");
|
||||
} catch (const std::exception& e) {
|
||||
return createErrorResponse(std::string("Invalid parameters: ") + e.what());
|
||||
}
|
||||
}
|
||||
|
||||
std::string CameraController::handleGetEHDRStatus() {
|
||||
int mode = 0, flag = 0;
|
||||
int expMin = 0, expMax = 0;
|
||||
int ratioMin = 0, ratioMax = 0;
|
||||
|
||||
if (VxGetISPImageProcessing(camera_, VX_ISP_IMAGE_PROPERTIES::ISP_IMAGE_EHDR_MODE, mode, flag) != 0) {
|
||||
return createErrorResponse("Failed to get eHDR mode");
|
||||
}
|
||||
|
||||
VxGetISPImageProcessing(camera_, VX_ISP_IMAGE_PROPERTIES::ISP_EHDR_EXPOSURE_MIN_NUMBER, expMin, flag);
|
||||
VxGetISPImageProcessing(camera_, VX_ISP_IMAGE_PROPERTIES::ISP_EHDR_EXPOSURE_MAX_NUMBER, expMax, flag);
|
||||
VxGetISPImageProcessing(camera_, VX_ISP_IMAGE_PROPERTIES::ISP_EHDR_RATIO_MIN, ratioMin, flag);
|
||||
VxGetISPImageProcessing(camera_, VX_ISP_IMAGE_PROPERTIES::ISP_EHDR_RATIO_MAX, ratioMax, flag);
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "{\"status\":\"success\",\"ehdr_mode\":" << mode
|
||||
<< ",\"exposure_min\":" << expMin
|
||||
<< ",\"exposure_max\":" << expMax
|
||||
<< ",\"ratio_min\":" << ratioMin
|
||||
<< ",\"ratio_max\":" << ratioMax << "}";
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::string CameraController::handleGetStatus() {
|
||||
std::ostringstream oss;
|
||||
oss << "{\"status\":\"success\",\"streaming\":" << (streamingEngine_->isRunning() ? "true" : "false")
|
||||
|
||||
Reference in New Issue
Block a user