简体   繁体   English

ImageJ,Java:如何将红色像素所包围的像素设置为红色(避免出现孔)

[英]ImageJ, Java: How can I set Pixels red which are sourounded by red Pixels (avoid holes)

I have the following problem: 我有以下问题:

I have written a plugin for ImageJ, which sets specific pixels (the blue ones = cells) to the color red. 我已经为ImageJ编写了一个插件,该插件将特定的像素(蓝色的=单元格)设置为红色。

Result after setting the blue pixels red 将蓝色像素设置为红色后的结果

结果

Now I also want to set also all the pixels, which are inside a marked area, to red. 现在,我还想将标记区域内的所有像素都设置为红色。

So I don't want to have any holes . 所以我不想有任何漏洞

Example for a hole: 孔的示例:

孔示例

I searched the web for hours, but I didn't find anything. 我在网上搜索了几个小时,但没有找到任何东西。 I hope somebody knows how I should deal with this issue. 我希望有人知道我应该如何处理这个问题。

Perhaps it is because the value of blue pixels varies. 也许是因为蓝色像素的值不同。 A better way would be to detect edges and then use flood fill algorithm to fill in the regions inside the boundary. 更好的方法是检测边缘,然后使用泛洪填充算法填充边界内的区域。

Found one sample code here http://imagej.net/Level_Sets with github source https://github.com/fiji/level_sets/ . http://imagej.net/Level_Sets和github源https://github.com/fiji/level_sets/处找到了一个示例代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM