How to crop image after regionprops

5 ビュー (過去 30 日間)
Kong
Kong 2020 年 3 月 18 日
編集済み: Sai Bhargav Avula 2020 年 3 月 25 日
Hello.
I found the centroid of an image like this. I want to crop the image using the centroid.
clear all
close all
I = imread('kong.jpg') ;
Ibw = im2bw(I);
Ibw = imfill(Ibw,'holes');
Ilabel = bwlabel(Ibw);
stat = regionprops(Ilabel,'centroid');
imshow(I); hold on;
for x = 1: numel(stat)
plot(stat(x).Centroid(1),stat(x).Centroid(2),'ro');
end

採用された回答

Sai Bhargav Avula
Sai Bhargav Avula 2020 年 3 月 23 日
編集済み: Sai Bhargav Avula 2020 年 3 月 25 日
Hi,
You can use imcrop to crop the image. The answer in the following link gives a detailed explanation on how to crop the image around the given centriod.
Hope this helps!

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by