Getting error while using the segmentImage(RGB) function to segment images by graph cut

I generated a segmentImage(RGB) function by choosing my desired foreground and background region using graph cut method. This function is working well with the original image I used to create the function. However, when I use this segmentImage(RGB) function to perform the same segmentation on another image, I get the following error message:
1)Error using lazysnapping>getIndices (line 297) Linear indices cannot exceed the number of elements in the label matrix.
2)Error in lazysnapping>validateInputs (line 258) foregroundInd = getIndices(foreground, size(L));
3)Error in lazysnapping (line 160) [foregroundInd,backgroundInd,is3D] = validateInputs(A,L,foreground,background);
4)Error in ImageAnalysis_v04_GraphCut>segmentImage_g (line 125) BW = lazysnapping(scaledX,L2,foregroundInd,backgroundInd);
5)Error in ImageAnalysis_v04_GraphCut (line 11) [g_BW,g_maskedImage] = segmentImage_g(i);
What is the reason for these errors? Thanks.

1 件のコメント

Madhab
Madhab 2022 年 12 月 26 日
@Shashank Hey, I am having exactly the same problem. If you solved it, can you please me guide the solution. Thanks.

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

回答 (0 件)

質問済み:

2018 年 9 月 20 日

コメント済み:

2022 年 12 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by