Matlab - using imquantize() - matlab

I found that there is a method called imquantize in order to make a quantization of the input image. I'm trying to make a quantization using 4-bits. I did the following:
>> quan = imquantize(im,16);
But, I got the following error:
??? Undefined function or method 'imquantize' for input arguments of type 'unit8'
How can I go around this?
Thanks.

imquantize is a new function introduced in Image Processing Toolbox R2012b. You can check which image processing toolbox is installed on your matlab (if any) by invoking this command:
ver

imquantize is new to the 2012b release of the Image Processing Toolbox. Therefore, if you don't have 2012b (released last month), you won't have imquantize.
In any case, your usage of imquantize would be incorrect. imquantize takes, as a second argument, a vector of levels to be used as the threshold. Those levels could, for example, be obtained through multithresh (which is also new to IPT 2012b).

Related

How do I use imhistmatch in Matlab?

I'm trying to implement with the matlab function imhistmatch.
So I use following commends.
A= imread('example1.jpg')
B= imread('example2.jpg')
C= imhistmatch(A,B)
But there is problem like this.
?? Undefined functionor method 'imhistmatch' for input arguments of type 'uint8'
So What am I suppose to do for solve?
I am not sure about your question. Are you trying to implement imhistmatch?
Then probably your function is in the wrong folder or you have a typo in the functions name.
use
addpath('Pathto/imhistmatch')
to ensure that matlab can find your implemented function.
But maybe you want to use the function imhistmatch provided by the image processing toolbox. Then, I guess you don't have the image processing toolbox.
Try
ver
and check the output. You should find these lines:
MATLAB Version X.X (XXXXX)
Image Processing Toolbox Version X.X (XXXXX)
If not, then you may want to buy the image processing toolbox, get a evaluation version or maybe try octave.
On my computer the following works:
imhistmatch(ones(10),ones(10))
imhistmatch(ones(10,'uint8'),ones(10,'uint8'))
but when I type
imhistmatch(ones(10,'int8'),ones(10,'int8'))
I get an error:
Error using imhistmatch
Expected input number 1, A, to be one of these types:
uint8, uint16, double, int16, single
Instead its type was int8.
...
So, if it would be a type problem you would see another error.
Your error is the result of not having the proper function imhistmatch.

How to use image fusion function in matlab?

I = imread('baboon.jpg')
Inimage = imguidedfilter(I)
imshow(Inimage)
Error: Undefined Function imguidedfilter
But when I search there appears to be a function by this name. Why?
MATLAB is regularly updated with new functions, and there are also multiple toolboxes (with their own updates). So the functions you can use depends on your version of MATLAB. Unfortunately it is not easy to find out in which version of MATLAB a function first became available.
You can use these functions to get some more information:
ver - to see what MATLAB version you have and which which toolboxes you have access to.
which - to see if a particular function is on your MATLAB path
e.g. which imguidedfilter will show you if you have access to the function imguidedfilter.
This particular function appears to be a very new function which you may need R2014a for (as I have R2013b and Image Processing Toolbox and don't have it).

Wavelet transform using dwt3 in MATLAB

I have a project to transform an image using dwt.
I successfully done it using function dwt2, and now I try to use function dwt3 by changes some code from the function dwt2 (add more subband: 8 subbands). Unfortunately, an error comes out, which said "Too many output arguments".
My question is, what is the right way to write MATLAB code for dwt3? Is it not same as dwt2, just add more subbands?
Just by looking at the official documentation for dwt2 and dwt3, I see that dtw3 has only 1 output variable, whereas dtw2 has 4.
I assume you just replaced the string dtw2 in your code to dwt3, without paying attention to the amount of allowed output variables. So there you go, that's where the error "too many output variables" comes from...
If dwt3 only returns the transformed vector, cut the number of output variables to 1, and I'm sure the error will away:
Y = dwt3(X, 'db2');
Here I transformed X using dwt3 with the Daubechies 2-tap wavelet, and stored the result in Y.
P.S
You need to show more code if you want more productive, helpful answers...

bi2de error in MatLab

In MatLab, "> help bi2de" provides the following example:
B = [0 0 1 1; 1 0 1 0];
D = bi2de(B)
But when I try this on my own, I get the following error:
??? Undefined function or method 'bi2de' for input arguments of type 'double'.
Is there something wrong with this function in MatLab?
I am pretty sure that the reason why this problem happened is because of the license of the toolbox, Communications system toolbook, in which this function belongs in. Write which bi2de and see what will be the result. If it returns path of the function and the comment Has no license available, then the problem is related to the license. That means, license of the toolbox is not set correctly. Mostly it happens if the toolbox is added later, i.e., after installation of the original matlab. Please check and solve the license issue, then it will work fine.
bi2de is a function in the Communications toolbox. You need to have that toolbox to use it. If you do have that toolbox, then the problem is that your B matrix is being treated as double instead of binary (I don't have the toolbox so I can't test this).
Consider using bin2dec, which turns a string representation ('1011001', eg) into a decimal number. This function is not part of a toolbox; it's available as part of the basic MATLAB package.

how can this function "resizeColumnscore" resizes image?

I want to know how can this function(from MATLAB) resize the columns of an input image using weights an indices previously computed.
Which equations uses to do that?
resizeColumnsCore(double(in), weights', indices');
When I looked for a function called resizeColumnsCore in MATLAB 7.11.0 (R2010b) I didn't find anything. However, I did find a MEX-file by that name in MATLAB 7.8.0 (R2009a) in this subdirectory of the Image Processing Toolbox:
C:\Program Files\MATLAB\R2009a\toolbox\images\images\private\
I guess they've phased it out or replaced it with another function in newer MATLAB versions. Now, if you want to know what the MEX-file does, you need to look at the source code it is compiled from. Luckily, it appears that this source code resizeColumnsCore.cpp can be found in the following directory:
C:\Program Files\MATLAB\R2009a\toolbox\images\images\private\src\misc\
And you can look through that code to determine the algorithms used to resize the columns of an image given a set of weights and indices.
Now, if you want to know how these input arguments to resizeColumnsCore are computed, you'll have to look at the code of a function that calls it. I know of at least one function in the IPT that calls this function: IMRESIZE. If you type edit imresize at the command prompt it will open that function in the Editor, allowing you to look through the code so you can see how the arguments to resizeColumnsCore are created.
What I can tell you for R2009a is that there is a subfunction in the file imresize.m called contributions which computes the weights and indices that are ultimately passed as arguments to resizeColumnsCore. That is where you will want to start looking to determine what algorithms are used to compute these arguments.
Looks like this isn't a proprietary MATLAB function. Could we see some code or a link to the code?