[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51884] [octave forge] (image) bwmorph(blackNw
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #51884] [octave forge] (image) bwmorph(blackNwhiteMatrix, "thicken", 1) returns negated result (+ strange behavior at border) |
Date: |
Wed, 30 Aug 2017 06:03:30 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 |
Follow-up Comment #4, bug #51884 (project octave):
sorry for the HTML character encoding of my posting below ...
(perhaps I should not have done a preview before ;-)
case "thicken";
## This implementation also "thickens" the border. To avoid this,
## a simple solution could be to add a border of 1 to the reversed
## image.
## 30-Aug-2017 MeJ:: going for a >>bwmorph(bw, 'thicken', n)<<; with
"add border workaround"
max_dim = max( size(bw) );
add_border = 2 * ( min([ ceil(max_dim/2), n ]) );
bw_framed = false(size(bw,1)+(2*add_border),size(bw,2)+(2*add_border));
lb1 = (add_border+1); ub1 = (size(bw,1)+add_border);
lb2 = (add_border+1); ub2 = (size(bw,2)+add_border);
bw_framed(lb1:ub1,lb2:ub2) = bw;
bw = ! bwmorph (! bw_framed, "thin", n);
loop_once = true;
morph = @(x) bwmorph (x, "diag");
post_morph = @(x) x(lb1:ub1,lb2:ub2);
## --------- original code fragement (as of octave forge package image
2.6.1)
## bw = bwmorph (! bw, "thin", n);
## loop_once = true;
## morph = @(x) bwmorph (x, "diag");
Testing:
---------
octave: test_bw = false(8,7); test_bw(6,3)=true; disp(test_bw);
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
octave: thickened_bw=bb=bwmorph(test_bw, "thicken", 1); disp(thickened_bw);
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 1 1 1 0 0 0
0 0 1 0 0 0 0
0 0 0 0 0 0 0
octave: thickened_bw=bb=bwmorph(test_bw, "thicken", 3); disp(thickened_bw);
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 1 1 1 0 0 0
1 1 1 1 1 0 0
1 1 1 1 1 1 0
1 1 1 1 1 0 0
0 1 1 1 0 0 0
# I am no expert in this area ... but the results look reasonable.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51884>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #51884] bwmorph(blackNwhiteMatrix, "thicken", 1) returns negated result (+ strange behavior at border), anonymous, 2017/08/29
- [Octave-bug-tracker] [bug #51884] [octave forge] (image) bwmorph(blackNwhiteMatrix, "thicken", 1) returns negated result (+ strange behavior at border), John W. Eaton, 2017/08/29
- [Octave-bug-tracker] [bug #51884] [octave forge] (image) bwmorph(blackNwhiteMatrix, "thicken", 1) returns negated result (+ strange behavior at border), anonymous, 2017/08/29
- [Octave-bug-tracker] [bug #51884] [octave forge] (image) bwmorph(blackNwhiteMatrix, "thicken", 1) returns negated result (+ strange behavior at border), Hartmut, 2017/08/29
- [Octave-bug-tracker] [bug #51884] [octave forge] (image) bwmorph(blackNwhiteMatrix, "thicken", 1) returns negated result (+ strange behavior at border), anonymous, 2017/08/30
- [Octave-bug-tracker] [bug #51884] [octave forge] (image) bwmorph(blackNwhiteMatrix, "thicken", 1) returns negated result (+ strange behavior at border),
anonymous <=
- [Octave-bug-tracker] [bug #51884] [octave forge] (image) bwmorph(blackNwhiteMatrix, "thicken", 1) returns negated result (+ strange behavior at border), anonymous, 2017/08/30
- [Octave-bug-tracker] [bug #51884] [octave forge] (image) bwmorph(blackNwhiteMatrix, "thicken", 1) returns negated result (+ strange behavior at border), Hartmut, 2017/08/30
- [Octave-bug-tracker] [bug #51884] [octave forge] (image) bwmorph(blackNwhiteMatrix, "thicken", 1) returns negated result (+ strange behavior at border), anonymous, 2017/08/31