threshold depth distance in image opencvsharp c# intel realsense

810 views Asked by At

This maybe a stupid question but how can you make a threshold so that the depth distance of the camera can get changed. Now I am using the Cv2.threshold to to that but with the otsu method the whole picture changes to one color instead of different kinds of a color. The code used:

var colorizedDepth = colorizer.Process<VideoFrame>(depthFrame).DisposeWith(frames);
                            Mat testcd = new Mat(colorizedDepth.Height, colorizedDepth.Width, MatType.CV_8UC3, colorizedDepth.Data);
                            Mat testgd = new Mat();
                            Cv2.CvtColor(testcd, testgd, ColorConversionCodes.RGBA2GRAY);
                            Mat testbd = new Mat();
                            Cv2.Threshold(testgd, testbd, 0, 255, ThresholdTypes.Otsu | ThresholdTypes.Binary);
                            Cv2.ImShow("camera", testgd);
                            Cv2.WaitKey(0);

The code to get the colored depth is from the wrapper librealsense: https://github.com/IntelRealSense/librealsense/tree/master/wrappers/csharp Does anyone know what I am doing wrong for the threshold so that the depth distances get changed?

0

There are 0 answers