Cannot Use activecontour function

조회 수: 1 (최근 30일)
Tai Pham
Tai Pham 2015년 1월 8일
답변: Sourabh 2025년 2월 17일
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

답변 (1개)

Sourabh
Sourabh 2025년 2월 17일
It seems that the issue is related to the input image. The activecontourfunction 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!

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by