How to segment a region

5 ビュー (過去 30 日間)
Warid Islam
Warid Islam 2019 年 7 月 10 日
コメント済み: Warid Islam 2019 年 7 月 11 日
I have an image from which I want to extract a region and display it in a separate image . I have written a code but it's displaying an error message.
Below is my code:
I = imread('Intensity1.jpg');
imshow(I)
hold on
mask = false(size(I));
mask(200:400) = true;
visboundaries(mask,'Color','b');
I want to extract the region from 200:400(i.e. only the yellow and green part of the image) and display them separately . But I am shown the following error message:
Error using visboundaries
Expected input number 1, BW, to be two-dimensional.
Error in visboundaries>obtainAndValidateBoundaries (line 236)
validateattributes(B, {'numeric','logical'}, {'2d','real','nonsparse'}, ...
Error in visboundaries>parseInputs (line 185)
boundaries = obtainAndValidateBoundaries(B,first_string);
Error in visboundaries (line 91)
[ax, boundaries, options] = parseInputs(varargin{:});
Error in I2 (line 7)
visboundaries(mask,'Color','b');

採用された回答

Image Analyst
Image Analyst 2019 年 7 月 10 日
Try this
hFig = figure;
subplot(1, 2, 1);
rgbImage = imread('Intensity1.jpg');
imshow(rgbImage)
subplot(1, 2, 2);
croppedImage = rgbImage(200 : 400, :, :);
imshow(croppedImage);
  1 件のコメント
Warid Islam
Warid Islam 2019 年 7 月 11 日
Hi,
That works perfect. Thanks a lot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by