英文:
Matlab's imimposemin function
问题
I don't quite understand Matlab's imimposemin
function described here. According to the documentation, the function modifies the grayscale mask image I using morphological reconstruction so it only has regional minima wherever the binary marker image BW is nonzero.
In the example that demonstrates the function, Mathworks creates a marker which is a black image with a small white square. According to the documentation, imimposemin
(if I understand correctly) should modify the array mask
so it has local minima wherever marker
is nonzero. In other words, it should modify the mask over that white square only and replace the corresponding values in mask
of those pixels with the regional minimum.
However, we see that almost every single pixel of mask
has changed value, and the image itself has become lighter. Why?
What am I missing?
英文:
I dont quite understand Matlab's imimposemin
function described here. According to the documentation the function modifies the grayscale mask image I using morphological reconstruction so it only has regional minima wherever binary marker image BW is nonzero.
In the example that demonstrates the function, Mathworks creates a marker which is a black image with a small white square. According to the documentation imimposemin
(if I undestand well) it should modify the array mask
so it has local minima wherever marker
is nonzero. In other words it should modify mask over that white square only and replace the corresponding values in mask
of those pixels with the regional minimum.
However we see that almost every single pixel of mask
has changed value and the image it self has become lighter. Why?
What am I missing?
答案1
得分: 1
只应修改白色正方形上的蒙版,并将这些像素的mask
中的相应值替换为区域最小值。
这将在marker
指示的位置创建局部最小值,但图像已经在其他地方有局部最小值,需要将其移除。
根据文档(我强调):
使用形态重建修改灰度蒙版图像I
,使其仅在二进制标记图像BW
上的区域最小值处存在。
也就是说,输出不能在marker
指定之外有局部最小值。这意味着必须修改mask
图像以删除其局部最小值。通过给予marker
中的像素最低可能值,并从那里传播,像素要么保持它们已有的值,要么取自相邻像素的较大值。您应该能够从图像中的任何像素绘制一条递减路径到marker
中的一个像素。
通常,此函数与分水岭一起使用,分水岭基于局部最小值对图像进行分割。通过强制施加您自己的局部最小值,您可以强制分水岭算法的种子。
英文:
> it should modify mask over that white square only and replace the corresponding values in mask
of those pixels with the regional minimum.
This would create local minima at the places indicated by marker
, but the image already had local minima elsewhere, which need to be removed.
From the docs (emphasis mine):
> modifies the grayscale mask image I
using morphological reconstruction so it only has regional minima wherever binary marker image BW
is nonzero.
That is, the output cannot have local minima outside those specified by marker
. This means that the mask
image must be modified to remove its local minima. This is accomplished by giving the pixels in marker
the lowest possible value, and, propagating from there, pixels get either the value they already had, or the larger value from the neighbor. You should be able to draw a decreasing path from any pixel in the image to one of the pixels in marker
.
This function is typically used in combination with the watershed, which segments the image based on local minima. By imposing your own local minima, you can force the seeds of the watershed algorithm.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论