IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.61k stars 4.83k forks source link

Couldn't get the edges of Depth Image when using MVTec Halcon #10652

Closed amar-mustaqim closed 2 years ago

amar-mustaqim commented 2 years ago

Required Info
Camera Model { D455 }
Operating System & Version {Win (10)
Kernel Version (Linux Only) (n.a.)
Platform PC
Language {Halcon}
Segment {Others}

Issue Description

Hi there, we have a Realsense Depth Camera D455 that we plan to use for checking the dimension of the box. We set the camera at the height of 2meter and plan to capture the depth image of the box, and from the depth image we are going to do some image processing later. Currently, we are using MVTec Halcon(Realsense interface) for our development and here is our result. The red circle is the box that we target to capture.

DimensionChecking_RGB_and_Depth Image_edit

These are the parameter that we use in our implementation: set_framegrabber_param(AcqHandle, 'SourceSelector', 'Depth') set_framegrabber_param(AcqHandle, 'ComponentSelector', 'Intensity') set_framegrabber_param(AcqHandle, 'ComponentEnable', 100) set_framegrabber_param(AcqHandle, 'DepthResolution', '848x480') set_framegrabber_param(AcqHandle_3D, 'LaserPower', 360.0)

My question is, how can we improve the result for the box? Is there a way we can get the edge of the box or the exact square shape of it? Any parameter in MVTec Halcon, configuration on the camera or suggestions can be made, please suggest.

Thank you in advance for your help.

MartyG-RealSense commented 2 years ago

Hi @amar-mustaqim The color shades of the cardboard box and the floor are similar, so the box does not stand out strongly on the depth image.

Are you able to set a RealSense Visual Preset camera configuration from within the MVTec Halcon? If so then setting the Medium Density preset may help to sharpen the edges of a 'blobby' cardboard box on the depth image whilst also providing accuracy, as demonstrated in a discussion about overhead depth-sensing of cardboard boxes at https://github.com/IntelRealSense/librealsense/issues/7021

amar-mustaqim commented 2 years ago

Hi @MartyG-RealSense , I have tried to test with different color background which are white and dark blue color, and I tried the Medium Density preset setting as suggested. However the result still same as before, no edges appeared for the box at the distance of 2meter from the camera.

Result of dark blue color background: DimensionChecking_blue_groundtruth

Result of white color background: DimensionChecking_white_groundtruth

Result with Medium Density preset: dimensionchecking_mediumdensity_blue_groundtruth

MartyG-RealSense commented 2 years ago

Are you able to use auto-exposure instead of a fixed manual exposure value of 33000? If you can use auto-exposure then please try setting ExposureAuto to On, as the current Off status of that setting in the above image suggests that auto-exposure is disabled.

amar-mustaqim commented 2 years ago

The ExposureAuto is already set to On by default in MVTec Halcon during the image acquisition, so even though I'm using auto-exposure the edge of the image still not captured. That's why I try changing the manual exposure value, which automatically will disable the ExposureAuto but, the result still same.

MartyG-RealSense commented 2 years ago

The depth images look very dark even though the RGB images show that there is good illumination. Could you try setting EmitterAlwaysOn to On (it is Off in the image of the settings) to make sure that the camera's dot pattern projection is active.

MartyG-RealSense commented 2 years ago

Hi @amar-mustaqim Do you require further assistance with this case, please? Thanks!

amar-mustaqim commented 2 years ago

Hi @MartyG-RealSense , yes I'm still need your help for this case but not immediately, maybe at the end of this month I'll come back for this case. As for now, we just lower down our camera setup until it able to get the edge of the box because we are focusing on the algorithm to measure the box dimension first.

MartyG-RealSense commented 2 years ago

Okay, that's no problem at all to come back to the case at the end of the month. Thanks very much for the update!

MartyG-RealSense commented 2 years ago

Hi @amar-mustaqim Do you have an update about this case that you can provide, please? Thanks!

amar-mustaqim commented 2 years ago

Hi @MartyG-RealSense I can say that this issue already solve and I will close it. Thank you so much for your assist. Cheers!

MartyG-RealSense commented 2 years ago

That's great news that you achieved a solution, @amar-mustaqim - thanks very much for the update :)

vpenev77 commented 5 months ago

Hi, I'm trying to grab a 2d rgb image using realsense and halcon but it doesn't work. Can you help me

MartyG-RealSense commented 5 months ago

Hi @vpenev77 If you are using MVTec Halcon then there is documentation for its RealSense interface at the link below.

https://www.mvtec.com/products/interfaces/documentation/view/18111-3d-camera-1811-progress-mvtecdoc-realsense

The documentation advises that the parameter color_space can be set to the value rgb instead of its default setting of 'default'.

Which RealSense camera model are you using, please?