K-NN Classsification on images
Show older comments
i1=dicomread('1.dcm');
i2=dicomread('2.dcm');
i3=dicomread('3.dcm');
i4=dicomread('4.dcm');
Sample=[i1;
i2];
Training=[i3;
i4];
Group=['1';
'2'];
k=2;
Class = knnclassify(Sample, Training, Group, k);
disp(Class);
I get an error - The length of GROUP must equal the number of rows in TRAINING.
The size of both the images are same.
It works when I'm using co-ordinates instead of i1, i2 and so on.
I know I should be using fitcknn, but it should work as well. Any inputs please?
Accepted Answer
More Answers (1)
Image Analyst
on 17 Mar 2017
0 votes
I know you've already accepted an answer, but you might want to check out my knn demo.
1 Comment
prahlad h
on 17 Mar 2017
Categories
Find more on Nearest Neighbors in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!