gray_insidegray_insideGrayInsideGrayInsidegray_inside (算子)

名称

gray_insidegray_insideGrayInsideGrayInsidegray_inside — 为图像中的每个点计算到图像边界的任意路径上的最低可能灰度值。

签名

gray_inside(Image : ImageDist : : )

Herror gray_inside(const Hobject Image, Hobject* ImageDist)

Herror T_gray_inside(const Hobject Image, Hobject* ImageDist)

void GrayInside(const HObject& Image, HObject* ImageDist)

HImage HImage::GrayInside() const

static void HOperatorSet.GrayInside(HObject image, out HObject imageDist)

HImage HImage.GrayInside()

def gray_inside(image: HObject) -> HObject

描述

gray_insidegray_insideGrayInsideGrayInsideGrayInsidegray_inside determines the “cheapest” path to the image border for each point in the image, i.e., the path on which the lowest gray values have to be overcome. The resulting image contains the difference of the gray value of the particular point and the maximum gray value on the path. Bright areas in the result image therefore signify that these areas (which are typically dark in the original image) are surrounded by bright areas. Dark areas in the result image signify that there are only small gray value differences between them and the image border (which doesn't mean that they are surrounded by dark areas; a small “gap” of dark values suffices). The value 0 (black) in the result image signifies that only darker or equally bright pixels exist on the path to the image border.

The operator is implemented by first segmenting into basins and watersheds the image using the watershedswatershedsWatershedsWatershedsWatershedswatersheds operator. If the image is regarded as a gray value mountain range, basins are the places where water accumulates and the mountain ridges are the watersheds. Then, the watersheds are distributed to adjacent basins, thus leaving only basins. The border of the domain (region) of the original image is now searched for the lowest gray value, and the region in which it resides is given its result values. If the lowest gray value resides on the image border, all result values can be calculated immediately using the gray value differences to the darkest point. If the smallest found gray value lies in the interior of a basin, the lowest possible gray value has to be determined from the already processed adjacent basins in order to compute the new values. An 8-neighborhood is used to determine adjacency. The found region is subtracted from the regions yet to process, and the whole process is repeated. Thus, the image is “stripped” form the outside.

Analogously to watershedswatershedsWatershedsWatershedsWatershedswatersheds, it is advisable to apply a smoothing operation before calling watershedswatershedsWatershedsWatershedsWatershedswatersheds, e.g., binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilterbinomial_filter or gauss_filtergauss_filterGaussFilterGaussFilterGaussFiltergauss_filter, in order to reduce the amount of regions that result from the watershed algorithm, and thus to speed up the processing time.

注意

请注意,若使用域缩减后的图像作为输入,滤波器算子可能会返回意外结果。请参阅 滤波器 一章

执行信息

参数

ImageImageImageImageimageimage (输入对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte)

Image being processed.

ImageDistImageDistImageDistImageDistimageDistimage_dist (输出对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject * (int2)

Result image.

示例(HDevelop)

read_image(Image,'fabrik')
gauss_filter (Image,GaussImage,11)
gray_inside(GaussImage,ImageOut)
dev_display(ImageOut)

示例(C)

read_image(Image,"fabrik");
gauss_filter(Image,&GaussImage,11);
gray_inside(GaussImage,Result);

示例(HDevelop)

read_image(Image,'fabrik')
gauss_filter (Image,GaussImage,11)
gray_inside(GaussImage,ImageOut)
dev_display(ImageOut)

示例(HDevelop)

read_image(Image,'fabrik')
gauss_filter (Image,GaussImage,11)
gray_inside(GaussImage,ImageOut)
dev_display(ImageOut)

示例(HDevelop)

read_image(Image,'fabrik')
gauss_filter (Image,GaussImage,11)
gray_inside(GaussImage,ImageOut)
dev_display(ImageOut)

结果

gray_insidegray_insideGrayInsideGrayInsideGrayInsidegray_inside 始终返回 2 ( H_MSG_TRUE )。

可能的前趋

binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilterbinomial_filter, gauss_filtergauss_filterGaussFilterGaussFilterGaussFiltergauss_filter, smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImagesmooth_image, mean_imagemean_imageMeanImageMeanImageMeanImagemean_image, median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image

可能的后继

select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center, count_objcount_objCountObjCountObjCountObjcount_obj

另见

watershedswatershedsWatershedsWatershedsWatershedswatersheds

模块

基础