I'm trying to save the edges in vector in .mat file how can i do that?

2 commentaires

Walter Roberson
Walter Roberson le 30 Mar 2017
how do you want the edges to be represented?
DSB
DSB le 30 Mar 2017
zero and one

Connectez-vous pour commenter.

 Réponse acceptée

Walter Roberson
Walter Roberson le 30 Mar 2017

0 votes

Suppose you have just done edge detection on an image, and suppose the name of the output matrix is EdgeMatrix . Then you can do
EdgeVector = EdgeMatrix(:);
save EdgeMat.mat EdgeVector

6 commentaires

DSB
DSB le 30 Mar 2017
ok but then how can i classify the edge?
You do not need to save in a .mat file to do classification.
You should probably be creating an array of values, with one column for each image, and using the neural network toolbox. To start you off I recommend using
nntool
DSB
DSB le 30 Mar 2017
no i don't need to used NN we have to classify it in SVM so what i'm trying to do to detect the edge and save it in .mat file then classify it but i don't know how to classify the edge
Walter Roberson
Walter Roberson le 30 Mar 2017
Modifié(e) : Walter Roberson le 10 Avr 2017
Imagine that you have a directory of image files.
Imagine further that the first letter of the file name is the class that the image belongs to. For example A_Image17.bmp belonging to group 'A' . Then,
projectdir = "Directory that image files are in";
image_extension = '*.bmp';
dinfo = dir( fullfile(projectdir, image_extension) );
num_file = length(dinfo);
for K = 1 : num_file
this_name = dinfo(K).name;
this_file = fullfile(projectdir, this_name);
this_image = imread(this_file);
Edge_Matrix = Detect_Edges_Of_Image(this_image);
EdgeVector = Edge_Matrix(:);
AllEdges(K, :) = EdgeVector;
this_target = this_name(1);
Targets{K} = this_target;
end
Now you can
SVMMdl = fitcsvm(AllEdges, Targets);
DSB
DSB le 10 Avr 2017
I got accuracy 68% do you know how can i improve the accuracy?!
Walter Roberson
Walter Roberson le 10 Avr 2017
Use a different Classification method, or experiment with different kernels, or choose a different set of features.
SVM on detected edges might not be a useful approach at all.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by