How to show its results
1 回表示 (過去 30 日間)
古いコメントを表示
I have downloaded this code from internet. It gives (Error using svmtrain (line 259) TRAINING and Y must both contain at least one row with no missing values.
Error in svm_test (line 41) SVMStruct = svmtrain(arrayImage, class);) How to remove this error?
I want to show result in the form of image, how to do this? (it did not show any output)
clear all;
clc;
folder = 'RandomNoisrData';
dirImage = dir( folder );
numData = size(dirImage,1);
M ={} ;
%Read image data
for i=1:numData
nama = dirImage(i).name;
if regexp(nama, '(DNoise|RNoise)-[0-2]{1,2}.jpg')
B = cell(1,2);
if regexp(nama, 'Noise-[0-2]{1,2}.jpg')
B{1,1} = double(imread([folder, '/', nama]));
B{1,2} = 1;
elseif regexp(nama, 'VNoise-[0-2]{1,2}.jpg')
B{1,1} = double(imread([folder, '/', nama]));
B{1,2} = -1;
end
M = cat(1,M,B);
end
end
% Image conversion for SVM purposes
numDataTrain = size(M,1);
class = zeros(numDataTrain,1);
arrayImage = zeros(numDataTrain, 300 * 300);
for i=1:numDataTrain
im = M{i,1} ;
im = rgb2gray(im);
im = imresize(im, [300 300]);
im = reshape(im', 1, 300*300);
arrayImage(i,:) = im;
class(i) = M{i,2};
end
SVMStruct = svmtrain(arrayImage, class);
% Test for Random Noise
lionTest = double(imread('RandomNoiseData/TestImage3.jpg' ));
lionTest = rgb2gray(lionTest);
lionTest = imresize(lionTest, [300 300]);
lionTest = reshape(lionTest',1, 300*300);
result = svmclassify(SVMStruct, lionTest);
result;
Please help
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Biotech and Pharmaceutical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!