Classification using KNN

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üye
Katılım
5 Şub 2019
Mesajlar
20
Tepki puanı
10
Yaş
36
7 HİZMET YILI
[CODE title="Classification using KNN"]clc;clear;close all;warning off all;



load HOG_features



% imaqreset;



% vid = videoinput('winvideo', 1, 'YUY2_640x480');

% src = getselectedsource(vid);

% vid.FramesPerTrigger = Inf;

% vid.ReturnedColorspace = 'rgb';

% start(vid);

% preview(vid);



%% Get snapshot and process frame image



% h = msgbox('Show Sign !');

% uiwait(h);

%

% im = getsnapshot(vid);



[f,p] = uigetfile('*.*');

im = imread([p,f]);



imshow(im);



% stop(vid);



cform = makecform('srgb2lab');

J = applycform(im,cform);

K=J:),:,2);

L=graythresh(J:),:,2));

BW1=im2bw(J:),:,2),L);

BW1=bwareaopen(BW1,500);

BB=regionprops(BW1,'Boundingbox');

pause(0.01)



gr = rgb2gray(im);



object = imcrop(gr,BB(1).BoundingBox);

object = imresize(object,[100,50]);

figure(2);imshow(object);



[feat] = hog_feature_vector(object);



class = knnclassify(feat,data,group);



switch class

case 0

tts('Sign of 0');

case 1

tts('Sign of 1');

case 2

tts('Sign of 2');

case 3

tts('Sign of 3');

case 4

tts('Sign of 4');

case 5

tts('Sign of 5');

case 6

tts('Sign of 6');

case 7

tts('Sign of 7');

case 8

tts('Sign of 8');

case 9

tts('Sign of 9');



end



imaqreset[/CODE]
 
Moderatörün son düzenlenenleri:
Onaylı Üye
Katılım
28 May 2020
Mesajlar
50
Tepki puanı
0
Ödüller
4
6 HİZMET YILI
pca mı?
Post automatically merged:

Yararlı paylaşım teşekkürler
 
Son düzenleme:
T H O R
Süper Üye
Katılım
12 Haz 2020
Mesajlar
644
Çözümler
2
Tepki puanı
110
Ödüller
5
Yaş
26
5 HİZMET YILI
ne işe yarıyor tam olarak
 
Seçkin Üye
Katılım
20 Haz 2020
Mesajlar
298
Çözümler
2
Tepki puanı
3
Ödüller
3
Sosyal
5 HİZMET YILI
KNN algorithm is used to classify by finding the K nearest matches in training data and then using the label of closest matches to predict. Traditionally, distance such as euclidean is used to find the closest match
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst