24小时热门版块排行榜    

查看: 3927  |  回复: 4
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

我爱小虫子

新虫 (正式写手)

[求助] 到底怎么实现,bwfill和imfill

在用MATLAB图像处理中用到填充的算法,在网上搜了也没看到清楚的,真心想搞明白bwfill这个函数到底是什么原理,怎么实现的,望大家给点帮助,万分感谢!
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

我爱小虫子

新虫 (正式写手)

引用回帖:
2楼: Originally posted by 月只蓝 at 2013-09-02 13:36:52
认真研读一下MATLAB的help文档吧,解释最权威:

BWFILL Fill background regions in binary image.

    BWFILL is a grandfathered function that has been replaced by
    IMFILL.

    BW2 = BWFILL ...

额,,,好吧,谢谢你。。。
4楼2013-09-03 07:57:36
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 5 个回答

月只蓝

主管区长 (职业作家)

【答案】应助回帖

感谢参与,应助指数 +1
认真研读一下MATLAB的help文档吧,解释最权威:

BWFILL Fill background regions in binary image.

    BWFILL is a grandfathered function that has been replaced by
    IMFILL.

    BW2 = BWFILL(BW1,C,R,N) performs a flood-fill operation on
    the input binary image BW1, starting from the pixel (R,C). If
    R and C are equal-length vectors, the fill is performed in
    parallel from the starting locations (R(k),C(k)). N can have
    a value of either 4 or 8 (the default), where 4 specifies
    4-connected foreground and 8 specifies 8-connected
    foreground. The foreground of BW1 comprises the "on" pixels
    (i.e., having value of 1).

    BW2 = BWFILL(BW1,N) displays the image BW1 on the screen and
    lets you select the starting points using the mouse. If you
    omit BW1, BWFILL operates on the image in the current
    axes. Use normal button clicks to add points. Press
    <BACKSPACE> or <DELETE> to remove the previously selected
    point. A shift-click, right-click, or double-click selects
    a final point and then starts the fill; pressing <RETURN>
    finishes the selection without adding a point.

    [BW2,IDX] = BWFILL(...) returns the linear indices of all
    pixels filled by BWFILL.

    BW2 = BWFILL(X,Y,BW1,Xi,Yi,N) uses the vectors X and Y to
    establish a nondefault spatial coordinate system for BW1. Xi
    and Yi are scalars or equal-length vectors that specify
    locations in this coordinate system.

    [X,Y,BW2,IDX,Xi,Yi] = BWFILL(...) returns the XData and YData
    in X and Y; the output image in BW2; linear indices of all
    filled pixels in IDX; and the fill starting points in Xi and
    Yi.

    BW2 = BWFILL(BW1,'holes',N) fills the holes in the binary
    image BW1. BWFILL automatically determines which pixels are
    in object holes, and then changes the value of those pixels
    from 0 to 1. N defaults to 8 if you omit the argument.

    [BW2,IDX] = BWFILL(BW1,'holes',N) returns the linear indices
    of all pixels filled in by BWFILL.

    If BWFILL is used with no output arguments, the resulting
    image is displayed in a new figure.

    Remarks
    -------
    BWFILL differs from many other binary image operations in
    that it operates on background pixels, rather than foreground
    pixels. If the foreground is 8-connected, the background is
    4-connected, and vice versa. Note, however, that you specify
    the connectedness of the foreground when you call BWFILL.

    Class Support
    -------------
    The input image BW1 must be a numeric or logical matrix. The output
    image BW2 is logical.

    See also bwselect, imfill, roifill.
MATLAB、MS小问题、普通问题请发帖求助!时间精力有限,恕不接受无偿私信求助。
2楼2013-09-02 13:36:52
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

libralibra

至尊木虫 (著名写手)

骠骑将军

【答案】应助回帖

感谢参与,应助指数 +1
主要用来填充图像中的孔洞
matlab/VB/python/c++/Java写程序请发QQ邮件:790404545@qq.com
3楼2013-09-02 18:31:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

我爱小虫子

新虫 (正式写手)

引用回帖:
3楼: Originally posted by libralibra at 2013-09-02 18:31:43
主要用来填充图像中的孔洞

恩,这个我知道,我想知道他的比较通俗易懂的原理,,,,谢谢哦
5楼2013-09-03 07:58:29
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[博后之家] 售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急 +3 k0dTPqJtl0jt 2026-08-14 3/150 2026-08-15 18:10 by 7huP8NPKZCp9
[硕博家园] 售SCI一区文章,我:8O5.5.1.O5.4,科目全,可伽急 +5 k0dTPqJtl0jt 2026-08-14 6/300 2026-08-15 18:06 by 7huP8NPKZCp9
[基金申请] 时间戳又变了8-15 +11 archvillain 2026-08-15 20/1000 2026-08-15 17:47 by 医学老男孩
[博后之家] 售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急 +3 HFw0lei2R37i 2026-08-14 5/250 2026-08-15 17:42 by 7huP8NPKZCp9
[考博] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +4 HFw0lei2R37i 2026-08-14 6/300 2026-08-15 17:34 by 7huP8NPKZCp9
[基金申请] 欢迎发来filecode的Mz6后的代码验证其规律 +27 医学老男孩 2026-08-13 58/2900 2026-08-15 15:57 by GZUZM
[考博] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +3 k0dTPqJtl0jt 2026-08-14 3/150 2026-08-15 12:33 by KxMI1BYBxWX1
[基金申请] 关于Filecode分析方法 +10 majunge000 2026-08-10 13/650 2026-08-15 12:26 by hanpeng972
[考研] 售SCI一区T0P文章,我:8.O.55.1.O.54,科目齐全,可+急 +5 HFw0lei2R37i 2026-08-14 9/450 2026-08-15 11:33 by KxMI1BYBxWX1
[公派出国] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +3 k0dTPqJtl0jt 2026-08-14 5/250 2026-08-15 07:09 by 4wMiSEwB6436
[论文投稿] 售SCI一区文章,我:8O5.5.1.O5.4,科目全,可伽急 +3 HFw0lei2R37i 2026-08-14 5/250 2026-08-15 00:16 by 4wMiSEwB6436
[基金申请] 是这周出结果还是下周出结果? +4 yuleib84 2026-08-11 4/200 2026-08-14 23:05 by lfy8008
[基金申请] filecode +15 documentary 2026-08-10 17/850 2026-08-14 10:08 by kissu88
[基金申请] FileCode能看出啥? +10 要乐观耀哥 2026-08-10 32/1600 2026-08-14 09:37 by 要乐观耀哥
[基金申请] 我的国基提前知道中了,可是同事的操作让我实在接受不了,怎么会有这样的人 +10 家与远方 2026-08-10 15/750 2026-08-14 02:08 by 绵羊哥哥
[基金申请] 静等基金结果 +8 gjjjzhong 2026-08-10 21/1050 2026-08-13 17:56 by 且听虎啸
[基金申请] 结合人工智能,周易传统文化,filecode打分制来了,3分以上希望很大。 +3 Tide man 2026-08-12 4/200 2026-08-13 08:35 by ZJTJZ
[基金申请] 综述论文作为代表作会不会影响评审专家的印象分? +11 yufeiwaner 2026-08-09 13/650 2026-08-12 08:17 by yufeiwaner
[基金申请] 国自然结果 +4 Vierhys 2026-08-10 8/400 2026-08-10 15:06 by Vierhys
[基金申请] 面上项目filecode邪修 +5 西山十月 2026-08-09 7/350 2026-08-10 07:32 by 仁砚薪传
信息提示
请填处理意见