how to save edges in vector

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

2 Commenti

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

Accedi per commentare.

 Risposta accettata

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 Commenti

DSB
DSB il 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 il 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 il 30 Mar 2017
Modificato: Walter Roberson il 10 Apr 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 il 10 Apr 2017
I got accuracy 68% do you know how can i improve the accuracy?!
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.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by