How to segment a region
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Warid Islam
le 10 Juil 2019
Commenté : Warid Islam
le 11 Juil 2019
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');
0 commentaires
Réponse acceptée
Image Analyst
le 10 Juil 2019
Try this
hFig = figure;
subplot(1, 2, 1);
rgbImage = imread('Intensity1.jpg');
imshow(rgbImage)
subplot(1, 2, 2);
croppedImage = rgbImage(200 : 400, :, :);
imshow(croppedImage);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Geometric Transformation and Image Registration dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!