-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It gives different results from Matlab, at least in Octave's Image Package 2.12.0
- Loading branch information
Showing
9 changed files
with
21 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function BW2 = bwselect_comp(BW1, C, R, N) | ||
% bwselect in some versions of Octave's Image Package (for example 2.12.0) gives different results | ||
% from those in Matlab. This fixes that. The approach used here is: find the connected components | ||
% and select those that contain any of the input pixels | ||
CC = bwconncomp(BW1, N); | ||
PixelIdxList = CC.PixelIdxList; | ||
clear CC | ||
lin_ind = sub2ind(size(BW1), R(:), C(:)); | ||
BW2 = false(size(BW1)); | ||
for c = 1:numel(PixelIdxList) | ||
if any(ismember(lin_ind, PixelIdxList{c})) | ||
BW2(PixelIdxList{c}) = true; | ||
end | ||
end | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters