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 comentarios

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

Iniciar sesión para comentar.

 Respuesta aceptada

Linda Pescatore
Linda Pescatore el 29 de Dic. de 2021

0 votos

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

1 comentario

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.

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 29 de Dic. de 2021

0 votos

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

Productos

Versión

R2021a

Preguntada:

el 29 de Dic. de 2021

Comentada:

el 29 de Dic. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by