Cannot Use activecontour function
1 回表示 (過去 30 日間)
古いコメントを表示
Hi Everyone,
I got a problem when I was learning how to use activecontour function in matlab. I met an error as following:

I also tried using the image in the example but the error still persists.

Please help me solve this problem.
Thanks and Best Regards, Tai Pham
0 件のコメント
回答 (1 件)
Sourabh
2025 年 2 月 17 日
Hey @Tai Pham
It seems that the issue is related to the input image. The “activecontour” function in MATLAB expects a 2D grayscale image.
To convert an image to grayscale you can use “rgb2gray” function as follows:
gray_img = rgb2gray(img); %now you get 2D grayscale image
% input the “gray_img” to "activecontour" function
For more details on using “activecontour” function, kindly refer the MATLAB example on “Segmenting Image Using Active Contours with Interactive Mask” by running the following command:
openExample('images/SegmentImageOverlayingMaskAndContourOnOriginalImageExample');
I hope this helps you!
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!