How to exclude the limit of ROI from boundaries detection

3 ビュー (過去 30 日間)
Gosselin Thibault
Gosselin Thibault 2018 年 7 月 3 日
Hello
A picture is better than a long speech. As you can see my function detects the edges of my ROI and conciders as a limit of my object. How to remove this (the line on the left and the right angle on the right)?
Here there is the code used :
clear all;
clc;
I = imread('Image1.PNG');
Icrop = imcrop(I);
subplot(2,2,1);
imshow(I);
title('Original Image');
subplot(2,2,2);
imshow(Icrop);
title('Cropped Image');
BW = im2bw(Icrop, graythresh(Icrop));
BW = bwareaopen(BW,50);
subplot(2,2,3);
imshow(BW);
title('Cropped BW Image');
[B,L] = bwboundaries(BW,'noholes');
subplot(2,2,4);
imshow(Icrop);
title('Crop Image with Boundaries Detected');
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 2)
Thank you !

回答 (0 件)

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by