matlab imimposemin函数,Impose minima

This example shows how to modify an image so that one area is always a regional minimum.

Read an image and display it. This image is called the mask image.

mask = imread('glass.png');

imshow(mask)

19ad12d8ba1acfbedb72b4030d13fdcf.png

Create a binary image that is the same size as the mask image and sets a small area of the binary image to 1. These pixels define the location in the mask image where a regional minimum will be imposed. The resulting image is called the marker image.

marker = false(size(mask));

marker(65:70,65:70) = true;

Superimpose the marker over the mask to show where these pixels of interest fall on the original image. The small white square marks the spot. This code is not essential to the impose minima operation.

J = mask;

J(marker) = 255;

figure

imshow(J)

title('Marker Image Superimposed on Mask')

783ea94090d23ed0462ed3b08880a690.png

Impose the regional minimum on the input image using the imimposemin function. Note how all the dark areas of the original image, except the marked area, are lighter.

K = imimposemin(mask,marker);

figure

imshow(K)

56ac71d01ef6645f846b42955ede182b.png

To illustrate how this operation removes all minima in the original image except the imposed minimum, compare the regional minima in the original image with the regional minimum in the processed image. These calls to imregionalmin return binary images that specify the locations of all the regional minima in both images.

BW = imregionalmin(mask);

figure

subplot(1,2,1)

imshow(BW)

title('Regional Minima in Original Image')

BW2 = imregionalmin(K);

subplot(1,2,2)

imshow(BW2)

title('Regional Minima After Processing')

e0c7878361dddd1ff1f86d9e92f2fda7.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值