UI520xSE-C gige sensor rectify failure

General Information

  • Product: UI520xSE-C
  • Serial Number: 4103427447
  • Ensenso SDK Version: 4.1.1033
  • Operating System: Linux / Windows
  • Data Attachments?

Problem / Question

Hello, I am using the gige sensor and trying to use the ensenso sdk api to rectify the image.
The piece of code doing rectification is like:

NxLibItem camera = NxLibItem("/Cameras/" + _deviceSerial);
camera[itmImages][itmRaw].setBinaryData(pFrame->imagesRaw);
NxLibCommand rectify(cmdRectifyImages, "rectify");
rectify.parameters()[itmCameras].set(_deviceSerial);
rectify.execute();

However, I am getting NxLibError: ExecutionFailed and path: /Execute/rectify from e.getErrorText() and e.getItemPath() where e is a type NxLibException variable.

Here’s a screenshot of the NxTreeEdit, hope it can help debugging.

How can I fix this? Any help is appreciated.

Hi @KuanYu,

rectifying user-provided images is currently not possible because they are missing some important metadata and there is no way to provide it. Exposure is not necessary for rectification, it is just the first attribute in the group being checked.

The usual sequence of cmdCapture, cmdRectify works fine, correct? Do you require setBinaryData for your application?

I will confer with my colleagues about this issue, but fixing it will require at least a bugfix release as I cannot think of any workaround.

Regards,
Raphael

Hi Raphael,

The image that I want to rectify is actually capture by the gige sensor using the NxLibCommand.

NxLibCommand capture(cmdCapture, "capture");
capture.parameters()[itmCameras].set(_deviceSerial);
capture.parameters()[itmTimeout].set(GetCaptureTimeout(_deviceSerial));
capture.execute();

And yes, the usual sequence of cmdCapture , cmdRectify works fine for us when we were using ensenso sdk version 3.5.1394.

By “the usual sequence” I mean: just calling the two commands without intervening calls to setBinaryData, as it is not necessary for what we consider normal operation:

Assuming you have only this one camera 4103427447 open, then

NxLibCommand(cmdCapture).execute();
NxLibCommand(cmdRectify).execute();

captures an image into the /Cameras/4103427447/Images/Raw node and rectifies it into /Cameras/4103427447/Images/Rectified, no setBinaryData necessary.

If you can tell me why you are using setBinaryData to overwrite the camera’s raw image, maybe we can find a way for you to work without setBinaryData.

@RSC Hello Raphael,

Actually, there was this line of code after capture.execute();

camera[itmImages][itmRaw].getBinaryData(pFrame->imagesRaw, 0);

After checking the code, the developer just get the binary data from the camera in the Capture step and set it to pFrame->imagesRaw, the type of this variable is std::vector<unsigned char>. And then when doing the Compute step, they set what they got from getBinaryData into setBinaryData using

camera[itmImages][itmRaw].setBinaryData(pFrame->imagesRaw);

But after referencing your answer, I removed both lines I mentioned above and then the Compute worked which made me so curious lol. Is there any explanation for this?

Thank you advance.

Internally, the NxLib has a binary pipeline associated to each camera, where the various binaries (e.g. raw and rectified images, disparity map, etc.) are stored. The commands automatically take the binaries from the camera pipelines as inputs and update the pipelines with their output.

The ability to write to some pipeline slots is a remnant of some exotic applications we had to support in the past, but this apparently got broken with improved meta-data handling inside the NxLib, which nobody had noticed before.

I would like to close this with a general rule for NxLib usage: If you are using setBinaryData, you are either doing something very exotic, or there is an easier way.

@RSC
Hi Raphael,

Thank you for the explanation.
So we decided not to use setBinaryData.
What about getBinaryData and getBinaryDataInfo? I think our code need to get some info from the image that the sensor captured, are getBinaryData and getBinaryDataInfo safe to use?

Thank you in advance.

Best,
KuanYu

That is good to hear, glad I could help.

Yes, absolutely. Using getBinaryData and getBinaryDataInfo is the only way to obtain binary data from the NxLib. If you can use OpenCV, you will probably not need getBinaryDataInfo, as all the information is already available from the cv::Mat returned by the OpenCV getBinaryData overload.

I just noticed that the OpenCV overloads are currently not documented in our manual. I will attempt to correct that.