I have a camera (Sekonix SF3325-100) and want to set the white balance.
Apparently I can do that using NvMediaISCSetWBGain() which requires me to call NvMediaISCRootDeviceCreate(). I am able to do this without errors (I don’t know if WB is set correctly thogh).
To read the images with DW I have to access the sensor with dwSAL_createSensor() after setting up dwContext and dwSAL.
However I can’t access the camera through both interfaces (ISC and DW) at the same time. No matter which one I start first, the second one crashes.
I tried setting WB first, then destroying the ISC device and accessing the camera with DW afterwards but that doesn’t have the desired effect.
Is there any way to set a camera’s white balance while accessing it through DW?
Dear nbussas,
There is no DW API which can set white balance.
Just to understand your case, Are you setting white balancing inside a DW application using NvMedia API? or you had set it in a separate NvMedia application and trying to run both NvMedia and DW applications at same time?
copy & pasted the relevant parts together, I hope I didn’t miss anything relevant
auto device = NvMediaISCRootDeviceCreate(ISC_RDEV_CFG(
NVMEDIA_IMAGE_CAPTURE_CSI_INTERFACE_TYPE_CSI_AB,
NVMEDIA_ISC_I2C_BUS_7));
if (device == NULL) {
return;
}
NvMediaISCWBGainControl ctrl;
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 4; j++) {
ctrl.wbGain[i].value[j] = 10; // some random value to check if setting WB makes a difference
}
if (!NvMediaISCSetWBGain(device, &ctrl)) // this function doesn't return an error
{
// NOP
}
// NvMediaISCRootDeviceDestroy(device); // enabling this line makes the execution work
dwContextParameters contextParams = dwContextParameters();
dwInitialize(&mContextHandle, DW_VERSION, &contextParams);
dwSAL_initialize(&mSALHandle, mContextHandle);
dwSensorParams sensorParams;
sensorParams.protocol = "camera.gmsl";
sensorParams.parameters = Parameters::serialize({
{"camera-type", "ar0231-rccb-ss3322"},
{"camera-count", "1"},
{"slave", "0"},
{"cross-csi-sync", "0"},
{"fifo-size", "3"},
{"output-format", "yuv"},
{"camera-mask", "0001"},
{"csi-port", "ab"},
}).c_str();
dwStatus s = dwSAL_createSensor(&mSensorHandle, sensorParams, mSALHandle); // This is where the execution fails.
if (s != DW_SUCCESS) {
std::cerr << "can't create sensor\n";
}
Dear nbussas,
The SAL creation already uses NvMediaISCRootDeviceCreate(). Since it is used for sensor control, you can only have one at a time per camera.
No. You can try reading a raw image and use dwSoftISP, you can change the white balance values in the dwImageCUDA.prop.meta.wbGain, which will then influence the behavior of dwSoftISP. Please check the sample sample_isp and file:///usr/local/driveworks-0.6/doc/nvdwx_html/group__soft__ISP.html to more details about dwSoftISP