Unrecognized function or variable 'colorize'.

Why can't i use the 'colorize' function despite having the Image Processing Toolbox™ Hyperspectral Imaging Library installed?
Thanks

3 Comments

Which MATLAB version are you using?
This function is Introduced in R2020a
i'm having the same problem with this function and the "selectBands" . No other functions of the toolbox/library

Sign in to comment.

 Accepted Answer

Before you use the colorize function, make sure you have hypercube object present in the workspace. If you are still facing issue, please share minimal code and data so that we can reproduce the issue.
Hope this helps

12 Comments

Hi, thank you.
I am creating my own synthetic hyperspectral MxNxC datacube. Does it only work for hypercube inputs? But it doesn't say that the input is not compatible, it says the function is unrecognized.
I have the variable 'syn_hyp' which is a 3D 100x300x224 double array and I was just following the example from MATLAB to try to see how it works.
coloredImg = colorize(syn_hyp,"Method","rgb","ContrastStretching",true);
I also tried to define the band as a 3 vector for RGB wavelength but doesn't work either.
"Unrecognized function or variable 'colorize'."
That is the error message yet the function exists in my toolbox.
Thank you for getting back. As mentioned in the documentation of colorize function, the input must be a hypercube object. So first create a hypercube object from your data and then use the colorize function.
Hope this helps.
The reason it would say not found is that colorize is a method of a class, rather than a stand-alone function that checks its inputs to see if they are supported.
If that so, how can I utilize it? Can I just do as Mr. Mohammed said and use it? I am sorry I don't really understand the stuff about the so called "method of a class".
Thanks.
Imagine you are standing in front of a device with at least some electronics, and the device has a "Run" button. When you push the "Run" button, does the device connect somehow to a planetary computer that checks to see what kind of device it is, and makes a decision about what to do? Or is the device a member of a class of similar objects each of which has a defined meaning of "Run" built into it locally, ignorning what any other kind of object might mean by "Run" ?
Classes are sort of like objects that have built-in behavior that define what "Run" (or "colorize") mean to them, ignoring what it might mean to something else. There is no planet-wide "colorize" function that checks whether a "colorize" behavior has been defined for that particular kind of input and then executes as appropriate: hypercube objects have built-in "colorize" that do not have to check whether the input is the right kind of input because it is local behavior for that kind of device that you cannot activate for other kinds of devices. Other kinds of objects, such as hyperhairdressers, might have their own "colorize" that only has meaning in context for them.
When you define your own .m function, unless you do so in a very specific way, you create a function that has to be prepared to accept any kind of input and has to verify that the inputs are something you can work with before going ahead with whatever. But hypercube class has been defined in that very specific way that attaches a local colorize behavior to it, and that behavior will not be activated for any other kind of objects.
Hi,
Thanks for the explanation! So, I do need a hypercubed data to use the function after all. Is it possible to write a hypercube from a 3D array? I have been looking but haven't found any solution.
Nevermind guys, I figured it out. Thank you so much for all your help. I will now accept this answer.
Btw, Mr. Raimondo seems to be having similar problem (see comments).
I now have no problem with the 'colorized' function but funnily enough, the problem still exists for the "denoiseNGMeet' function. That's strange.
@Fadhli Atarita denoiseNGMeet supports both the hypercube object and 3-D numeric array. What error message are you getting while using the denoiseNGMeet function?
Hi,
The same error, "Unrecognized function or variable 'denoiseNGMeet'."
What is the class() of the data you are passing in for it?
Hypercube, the one that I tried colorize on and it worked for that.

Sign in to comment.

More Answers (0)

Products

Release

R2020b

Community Treasure Hunt

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

Start Hunting!