Image processing using knn
이전 댓글 표시
I have 3 images that I have to label using the knn algorithm and another 18 images that i know. I don't know how to label those 18 img using a variable 18x1 named etichete and don't know how to classificate them using the knn. ext_auto is the function for maximum contrast extension. And it doesn't show hist1,hist2, hist3.
- maximum contrast extension, adaptive variant
- histogram calculation
- patient identification using the algorithm for classifying the closest k-neighbors (k-nearest neighbor - knn), the comparison will be made at the histogram level.
img1 = imread('img34.png');
img2 = imread('img35.png');
img3 = imread('img36.png');
img1 = ext_auto(img1,1);
img2 = ext_auto(img2,1);
img3 = ext_auto(img3,1);
hist1 = histogram(img1,'Normalization','probability');
hist2 = histogram(img2,'Normalization','probability');
hist3 = histogram(img3,'Normalization','probability');
figure,
subplot(2,3,1), imshow(hist1);
subplot(2,3,2), imshow(hist2);
subplot(2,3,3), imshow(hist3);
locatie = 'C:\Users\User\Desktop\Facultate\Anul III\Semestrul II\tsim\Tema2\antrenare';
files=dir(fullfile(locatie, '*.png'));
load('etichete.mat');
h = zeros(length(files),256);
for i = 1:length(files)
FileName = fullfile(locatie, files(i).name);
img = imread(FileName);
img = ext_auto(img,1);
hist = histogram(img,'Normalization','probability');
figure(i), imhist(img);
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!