-1

I am getting mask image and RGB image from Unreal Engine using UnrealCV. Here, I also get the color information(R, G, B) of the object using UnrealCV from the mask image. Now, I want to know how can I pass this RGB information to OpenCV to do the thresholding.

I am doing now this stuff converting the mask image to Grayscale image and then doing the thresholding. But I don't want to do this. I have checked this answer but here image range has used which I also don't want to do. As in the mask image, every object has its unique color information so I just want to be more specific by sending the RGB information of the desired object from the mask image and then want to tell OpenCV to do the thresholding on the color that I have sent to OpenCV thresholding function.

The code used to get the RGB information is --

get_mask_color= client.request('vget /object/object_name/color')

It will give the mask color and then I want to pass it to OpenCV for the thresholding purpose.

I expect that it will do the thresholding as like as it is now doing on Grayscale image and then I will use the thresholded image to do the contour operation.

4

1 回答 1

0

在灰度图像中,阈值处理将暗像素与亮像素分开,即将灰度范围分成两个子区间。这是基于(天真的)前提,即感兴趣的对象由最亮(或最暗)的颜色组成。

稍微更合乎逻辑的方法是考虑由两个阈值(平均颜色±最大变化)定义的子区间内的像素值。如果感兴趣的对象有几种不同的颜色,每种颜色都对应一个灰度值区间,这些值会重叠或不重叠。实际上,这效果不佳,因为场景中的许多其他特征可能具有相同的灰度级。

在颜色的情况下,事情就更复杂了。统一的颜色定义了 RGB 空间中的一个点,当您考虑变化时,您会观察到具有特定形状的整个体积。如果幸运的话,形状是一个紧凑的椭圆体;如果有阴影和/或阴影效果,则该形状可以是圆锥形的并且更加扩展。

同样,当对象由几种颜色组成时,体积可以由几个重叠或孤立的形状组成。

要处理给定的应用程序,您必须了解与您的对象对应的 RGB 云的形状,并找到合适的几何描述。作为第一个近似值,您可以使用具有给定中心和范围的立方体或球体。

于 2019-06-06T12:20:39.110 回答