Error when I click Color Thresholder app

I'm attempting to follow the live script titled Segment Image and Create Mask Using Color Thresholder App. I've run the app before so I'm unclear why it stopped working for me, but could it be because of something I saved from running it before? I did clear everything from the workspace and Command Window before starting.
I run the first section of the live script, which is just
rgb = imread('peppers.png');
Looks good; the variable is in my workspace and it appears with imshow(rgb). Next instruction says, "Open the Color Thresholder app from the MATLAB toolstrip. On the Apps tab, in the Image Processing and Computer Vision section, click Color Thresholder."
According to the instructions, I should see a big blank page with controls in a ribbon at the top. Then I can load the image. However, as soon as I click the Color Thresholder button in the Apps section, I get this error in red text:
Not enough input arguments.
Error in colorThresholder (line 15)
I = rgb2ycbcr(RGB);
The live script then says I could alternative open the app by typing colorThresholder(rgb) at the command line (I assume meaning the Matlab command window?) and I tried that. An almost all-black binary image appeared in the workspace with the ans name. I never got the app interface, never was able to choose a color space, etc.
Any ideas why this is happening?

2 件のコメント

VBBV
VBBV 2021 年 12 月 29 日
Run profiler tool for the script and see what messages you get as recommended changes
Linda Pescatore
Linda Pescatore 2021 年 12 月 29 日
I renamed the files saved from my previous use of the app, and that took care of the problem. Thank you!

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

 採用された回答

Linda Pescatore
Linda Pescatore 2021 年 12 月 29 日

0 投票

I renamed the files saved from my previous use of the app, and that took care of the problem.

1 件のコメント

Image Analyst
Image Analyst 2021 年 12 月 29 日
That should not have been a problem unless you had scripts named colorThresholder.m or rgb2ycbcr.m. Is that what you had? (Perhaps you discovered that by editing the file like I suggested in my Answer and saw that it was your function, not the built-in one).
You should never name your scripts after built-in functions.
You can check by doing
which -all colorThresholder
If you see anything in the list that is your function, you should rename it.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2021 年 12 月 29 日

0 投票

Can you edit it and step through one line at a time:
>> edit colorThresholder.m

製品

リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by