how to save edges in vector

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

2 comentarios

Walter Roberson
Walter Roberson el 30 de Mzo. de 2017
how do you want the edges to be represented?
DSB
DSB el 30 de Mzo. de 2017
zero and one

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de Mzo. de 2017

0 votos

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 comentarios

DSB
DSB el 30 de Mzo. de 2017
ok but then how can i classify the edge?
Walter Roberson
Walter Roberson el 30 de Mzo. de 2017
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 el 30 de Mzo. de 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 el 30 de Mzo. de 2017
Editada: Walter Roberson el 10 de Abr. de 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 el 10 de Abr. de 2017
I got accuracy 68% do you know how can i improve the accuracy?!
Walter Roberson
Walter Roberson el 10 de Abr. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

DSB
el 29 de Mzo. de 2017

Comentada:

el 10 de Abr. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by