How to show its results

조회 수: 1 (최근 30일)
shafaq nisar
shafaq nisar 2017년 6월 4일
댓글: KSSV 2017년 6월 5일
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
  댓글 수: 1
KSSV
KSSV 2017년 6월 5일
You have not given input properly....I suspect...

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Biotech and Pharmaceutical에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by