Plotting results of SVM on the trained images in Matlab

3 views (last 30 days)
I am trying to find horizon line with hog feature extraction and svm training in sea images. The SVM training is done and it is working. I would like to show predicted labels on test images.
`% Bring predicted label to the horizon/background split
hPredict_label = Predict_label(1:length(hlabelTest));
bPredict_label = Predict_label(length(hlabelTest)+1:length(hlabelTest)+length(blabelTest));
% Vizualize predicted/classified data
for i=1:original_imagestest_db.Count
original_file = original_imagestest_db.ImageLocation{i};
figure(200)
x = imread(original_file);
x = imresize(x,[400,400]);
imshow(x);
hold on
num_hf = size(dataset.HorizonFeatsTest{i},1);
num_bf = size(dataset.BgFeatsTest{i},1);
for n=1:num_hf
plot(hxhy(:,1),'ro');
end
for n=1:num_bf
plot(bxby(:,1),'go');
end
end `
actually bxby and hxhy are the x and y coordinates of randomly chosen on the images but the problem is i should not plot them. because they are from training part. I wanna plot the labels and show correct or wrong. When I try to plot hPredict_label it gaves 1 1 1 1 coordinates because these are the 1 labels for horizon on the image.
Do you have any suggestions or any idea?
Thank you

Answers (1)

Image Analyst
Image Analyst on 6 Jun 2017
I can't reproduce your results or help you since I don't have your data or code up until then. But if you "wanna plot the labels and show correct or wrong" I suggest you use sprintf() to make up text strings for labels, and use text() to place those strings in the overlay above the image.
  1 Comment
Elf
Elf on 6 Jun 2017
Edited: Elf on 6 Jun 2017
thank you for the answer. but how can i plot labels? for example i want to make a comparison. such as i need feature test location which is hfsTest in my code and the correct label is in my ground truth data which is hfeats, i wanna plot the location on the image (is it possible to do that from features?) then if it is correct i will plot in green if it's not a correct classification in red.

Sign in to comment.

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!