文档

imtophat

顶帽过滤

句法

IM2 = Imtophat(IM,SE)
im2 = imtophat(im,nhood)
gpuarrayim2 = imtophat(gpuarrayim,___

描述

IM2 = Imtophat(IM,SE)在灰度或二进制输入图像上执行形态学上帽过滤我是。顶帽过滤计算图像的形态开放(使用iMopen),然后从原始图像中减去结果。imtophat使用结构元素se, 在哪里se归还Strelse必须是一个单个结构元素对象,而不是包含多个结构元素对象的数组。

im2 = imtophat(im,nhood)在哪里是指定结构元件的大小和形状的0s和1s的数组,与imptophat(IM,strel(nhone))

gpuarrayim2 = imtophat(gpuarrayim,___在GPU上执行操作。是由Strel(NHOOD), 如果是一个数组01s that specifies the structuring element neighborhood. If是一个gpuarray,,,,strel(聚集(nhood))指定结构元素邻域。

课堂支持金宝app

我是可以是数字或逻辑的,必须是非sparse。输出图像IM2具有与输入图像相同的类。如果输入是二进制的(逻辑),,,,the structuring element must be flat.

gpuarrayim必须是一个gpuarray类型UINT8or逻辑。当与gpuarray,,,,the structuring element must be flat and two-dimensional.

The output has the same class as the input.

例子

全部收缩

此示例显示了如何使用磁盘形结构元件使用顶帽过滤,以从具有深色背景的图像中删除不平坦的背景照明。

阅读图像并显示。

原始= imread('rice.png');imshow(原始)

创建结构元素。

se = strel('磁盘',,,,12);

执行顶级滤波器并显示图像。

tophatFiltered = Imtophat(原始,SE);图IMSHOW(TopHatFilterter)

利用Imadjustto improve the visibility of the result.

对比= imadjust(tophatfiltered);图IMShow(对比)

您可以使用上流社会的过滤纠正不均匀lumination when the background is dark. This example uses top-hat filtering with a disk-shaped structuring element to remove the uneven background illumination from an image.

阅读图像并显示。

原始= imread('rice.png');figure, imshow(original)

创建结构元素。

se = strel('磁盘',,,,12);

执行顶级滤波器并显示图像。注意示例如何将图像传递给gpuarray在将其传递给imtophat功能。

tophatfiltered = imtophat(gpuarray(原始),se);图,imshow(tophatFilterter)

利用Imadjustto improve the visibility of the result. The收集function is used to retrieve the contents of thegpuarray来自GPU。

对比= imadjust(收集(tophatfiltered));图,Imshow(对比)

扩展功能

Introduced before R2006a

这个话题有帮助吗?