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

2 件のコメント

Walter Roberson
Walter Roberson 2017 年 3 月 30 日
how do you want the edges to be represented?
DSB
DSB 2017 年 3 月 30 日
zero and one

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2017 年 3 月 30 日

0 投票

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 件のコメント

DSB
DSB 2017 年 3 月 30 日
ok but then how can i classify the edge?
Walter Roberson
Walter Roberson 2017 年 3 月 30 日
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 2017 年 3 月 30 日
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 2017 年 3 月 30 日
編集済み: Walter Roberson 2017 年 4 月 10 日
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 2017 年 4 月 10 日
I got accuracy 68% do you know how can i improve the accuracy?!
Walter Roberson
Walter Roberson 2017 年 4 月 10 日
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.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by