From: Adhi on
Hello,

Need urgent help, so everyone got the answer please help me
i am newbie on image processing, so i want to learn from examples given by matlab.
I am using matlab r2009a and try the demos - image processing - Color-Based Segmentation Using K-Means Clustering. I run the .m file but it show some failure.

??? Error using ==> kmeans
Too many input arguments.

Error in ==> ipexhistology at 59
[cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ...

how can a demos provided can go wrong??

regards
Adhi
From: ImageAnalyst on
Adhi:
Sorry - I can't try it. I'm using R2010a, and besides, it says "This
demo requires the Statistics Toolbox." which I don't have. That demo
requires more than just the Image Processing Toolbox. I tried anyway,
but it bombed when I ran it because kmeans wasn't defined. Do you
have the Statistics toolbox? What does it say when you say "ver" at
the command line? What toolboxes does it list for you?

From: Adhi on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <714ae6d1-0ab3-4180-a33b-7054c3c8acf6(a)t20g2000yqe.googlegroups.com>...
> Adhi:
> Sorry - I can't try it. I'm using R2010a, and besides, it says "This
> demo requires the Statistics Toolbox." which I don't have. That demo
> requires more than just the Image Processing Toolbox. I tried anyway,
> but it bombed when I ran it because kmeans wasn't defined. Do you
> have the Statistics toolbox? What does it say when you say "ver" at
> the command line? What toolboxes does it list for you?

thanks for your reply

when i type
ver
==============================================
MATLAB Version 7.8 (R2009a)
Simulink Version 7.3 (R2009a)
Aerospace Blockset Version 3.3 (R2009a)
Aerospace Toolbox Version 2.3 (R2009a)
Bioinformatics Toolbox Version 3.3 (R2009a)
Communications Blockset Version 4.2 (R2009a)
Communications Toolbox Version 4.3 (R2009a)
Control System Toolbox Version 8.3 (R2009a)
Curve Fitting Toolbox Version 2.0 (R2009a)
Data Acquisition Toolbox Version 2.14 (R2009a)
Database Toolbox Version 3.5.1 (R2009a)
Datafeed Toolbox Version 3.3 (R2009a)
EDA Simulator Link DS Version 2.1 (R2009a)
EDA Simulator Link IN Version 2.4 (R2009a)
EDA Simulator Link MQ Version 2.6 (R2009a)
Econometrics Toolbox Version 1.1 (R2009a)
Embedded IDE Link CC Version 3.4 (R2009a)
Embedded IDE Link MU Version 1.2 (R2009a)
Embedded IDE Link TS Version 1.4 (R2009a)
Embedded IDE Link VS Version 2.2 (R2009a)
Filter Design HDL Coder Version 2.4 (R2009a)
Filter Design Toolbox Version 4.5 (R2009a)
Financial Derivatives Toolbox Version 5.4 (R2009a)
Financial Toolbox Version 3.6 (R2009a)
Fixed-Income Toolbox Version 1.7 (R2009a)
Fixed-Point Toolbox Version 2.4 (R2009a)
Fuzzy Logic Toolbox Version 2.2.9 (R2009a)
Gauges Blockset Version 2.0.5 (R2009a)
Genetic Algorithm and Direct Search Toolbox Version 2.4.1 (R2009a)
Image Acquisition Toolbox Version 3.3 (R2009a)
Image Processing Toolbox Version 6.3 (R2009a)
Instrument Control Toolbox Version 2.8 (R2009a)
MATLAB Builder EX Version 1.2.12 (R2009a)
MATLAB Builder JA Version 2.0.3 (R2009a)
MATLAB Builder NE Version 3.0.1 (R2009a)
MATLAB Compiler Version 4.10 (R2009a)
MATLAB Distributed Computing Server Version 4.1 (R2009a)
MATLAB Report Generator Version 3.6 (R2009a)
Mapping Toolbox Version 2.7.2 (R2009a)
Model Predictive Control Toolbox Version 3.1 (R2009a)
Model-Based Calibration Toolbox Version 3.6 (R2009a)
Neural Network Toolbox Version 6.0.2 (R2009a)
OPC Toolbox Version 2.1.3 (R2009a)
Optimization Toolbox Version 4.2 (R2009a)
Parallel Computing Toolbox Version 4.1 (R2009a)
Partial Differential Equation Toolbox Version 1.0.14 (R2009a)
RF Blockset Version 2.4 (R2009a)
RF Toolbox Version 2.5 (R2009a)
Real-Time Windows Target Version 3.3 (R2009a)
Real-Time Workshop Version 7.3 (R2009a)
Real-Time Workshop Embedded Coder Version 5.3 (R2009a)
Robust Control Toolbox Version 3.3.3 (R2009a)
Signal Processing Blockset Version 6.9 (R2009a)
Signal Processing Toolbox Version 6.11 (R2009a)
SimBiology Version 3.0 (R2009a)
SimDriveline Version 1.5.2 (R2009a)
SimElectronics Version 1.2 (R2009a)
SimEvents Version 2.4 (R2009a)
SimHydraulics Version 1.5 (R2009a)
SimMechanics Version 3.1 (R2009a)
SimPowerSystems Version 5.1 (R2009a)
Simscape Version 3.1 (R2009a)
Simulink 3D Animation Version 5.0 (R2009a)
Simulink Control Design Version 2.5 (R2009a)
Simulink Design Optimization Version 1.0 (R2009a)
Simulink Design Verifier Version 1.4 (R2009a)
Simulink Fixed Point Version 6.1 (R2009a)
Simulink HDL Coder Version 1.5 (R2009a)
Simulink Report Generator Version 3.6 (R2009a)
Simulink Verification and Validation Version 2.5 (R2009a)
Spline Toolbox Version 3.3.6 (R2009a)
Spreadsheet Link EX Version 3.0.3 (R2009a)
Stateflow Version 7.3 (R2009a)
Stateflow Coder Version 7.3 (R2009a)
Statistics Toolbox Version 7.1 (R2009a)
Symbolic Math Toolbox Version 5.2 (R2009a)
System Identification Toolbox Version 7.3 (R2009a)
SystemTest Version 2.3 (R2009a)
Target Support Package FM5 Version 2.2.3 (R2009a)
Target Support Package IC1 Version 1.5.3 (R2009a)
Target Support Package TC2 Version 3.2 (R2009a)
Target Support Package TC6 Version 3.6 (R2009a)
Vehicle Network Toolbox Version 1.0 (R2009a)
Video and Image Processing Blockset Version 2.7 (R2009a)
Wavelet Toolbox Version 4.4 (R2009a)
xPC Target Version 4.1 (R2009a)
xPC Target Embedded Option Version 4.1 (R2009a)

if i type kmeans command like IDX = kmeans(X,k) with 2 parameters it seems worked but if i try command like
[idx,ctrs] = kmeans(X,2,...
'Distance','city',...
'Replicates',5,...
'Options',opts);
it shows error like i told before.

I am working on a final project about segmentation and using matlab for analysis. I decided to learn and probably use kmeans algorithm because i saw in the demos its quite good to segment an image.
and i am sorry if my grammar is bad

regards
Adhi
From: Adhi on
Other error is occured in the demos, in the Step 4 :

pixel_labels = reshape(cluster_idx,nrows,ncols);
imshow(pixel_labels,[]), title('image labeled by cluster index');

??? Error using ==> reshape
To RESHAPE the number of elements must not change.
i realize that the matrix size of cluster_idx is 1x3 and thats the reason its cant be reshaped to nrows x ncols.

So, how to return the result from kmeans to the image? i means the working algorithm for STEP 4.

thank you for your reply and your answer before,

regards

Adhi
From: Ashish Uthama on
On Sat, 20 Mar 2010 21:43:02 -0400, Adhi <adhi.blackmage(a)gmail.com> wrote:

> Hello,
>
> Need urgent help, so everyone got the answer please help me
> i am newbie on image processing, so i want to learn from examples given
> by matlab.
> I am using matlab r2009a and try the demos - image processing -
> Color-Based Segmentation Using K-Means Clustering. I run the .m file
> but it show some failure. ??? Error using ==> kmeans
> Too many input arguments.
>
> Error in ==> ipexhistology at 59
> [cluster_idx cluster_center] =
> kmeans(ab,nColors,'distance','sqEuclidean', ... how can a demos provided
> can go wrong??
>
> regards
> Adhi

Can you confirm that the KMEANS function you have on path is part of the
stats toolbox?
(Try 'which kmeans')

The demo runs fine on my installation.
My guess is you have a custom KMEANS implementation on your path.
 |  Next  |  Last
Pages: 1 2
Prev: mclmainFcn
Next: Blockproc vs blkproc problem