Why region_seg_demo is not working for the imcrop size of my preference?

1 回表示 (過去 30 日間)
Stelios Fanourakis
Stelios Fanourakis 2019 年 4 月 26 日
コメント済み: Stelios Fanourakis 2019 年 4 月 26 日
Hi
I use the below code I found in the Mathworks community
S = uigetfile('*');
Img= imread(S);
Img = double(Img(:,:,1));
Img = imcrop(Img,[253.25 158.25 447 132]);
I = Img;
m = zeros(size(I,1),size(I,2)); %-- create initial mask
m(5:80,80:550) = 1;
I = imresize(I,.5); %-- make image smaller
m = imresize(m,.5); % for fast computation
subplot(2,2,1); imshow(I); title('Input Image');
subplot(2,2,2); imshow(m); title('Initialization');
subplot(2,2,3); title('Segmentation');
figure
seg = region_seg(I, m, 3000); %-- Run segmentation
subplot(2,2,4); imshow(seg); title('Global Region-Based Segmentation');
And I get the below error when I choose my preffered cropping size window
Index exceeds the number of array elements (15008).
Error in region_seg (line 51)
u = sum(I(upts))/(length(upts)+eps); % interior mean
Error in region_seg_demo (line 30)
seg = region_seg(I, m, 3000); %-- Run segmentation
Any idea the cause of this error?
Thanks
  1 件のコメント
Stelios Fanourakis
Stelios Fanourakis 2019 年 4 月 26 日
Let me know if I have to upload anything such as the image I am trying to crop or the region_seg code.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeVehicle Scenarios についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by