How do I save a histogram after I extract the LBP feature?

3 views (last 30 days)
Mansell Teh
Mansell Teh on 18 Oct 2016
Hello everyone, I am currently working on an age-invariant face recognition system. I started off implementing a face detection algorithm, then close cropping it, and turning it into a grayscale image. Then I applied LBP feature extraction and normalized the histogram. Now I want to save all the value of the histogram for further face recognition process. Here are my codes .
clear all
clc
%Detect objects using Viola-Jones Algorithm
%image directory
imgdir = 'C:\Users\PC\Documents\MATLAB\testingimage';
DestDir = 'C:\Users\PC\Documents\MATLAB\croppedimage';
%To detect Face
FDetect = vision.CascadeObjectDetector;
I = imread('sub1img1.jpg');
%Returns Bounding Box values based on number of objects
BB = step(FDetect,I);
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',5,'LineStyle','-','EdgeColor','r');
croppedimage = imcrop(I,BB(i,:));
%check if image is gray, if not, convert to gray
if size(croppedimage, 3) == 3
croppedimage = rgb2gray(croppedimage);
end
end
% Apply local binary pattern feature extraction
mapping = getmapping(8,'u2');
H1 = lbp(croppedimage,1,8,mapping,'nh'); %LBP histogram in (8,1) neighborhood
%stem(H1); %using uniform pattern

Answers (1)

Soma Ardhanareeswaran
Soma Ardhanareeswaran on 21 Oct 2016
You can save the workspace variables and retrieve it into MATLAB using the 'save' and 'load' commands. Refer to https://www.mathworks.com/help/matlab/matlab_env/save-load-and-delete-workspace-variables.html

Community Treasure Hunt

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

Start Hunting!

Translated by