I have an image which has been divided into 49 blocks. from the block I would like to get the feature vector of LBP from each cell. what can i do?
any advise is greatly appreciated.
proceed = 1; data_matrix = []; ids = []; conut = 0; l=0; for i=1:100 for j=1:10 s = sprintf('database/s%i/%i.jpg',i,j); X = double(imread(s)); [rows columns] = size(X); blockSizeR = 45; % Rows in block.
blockSizeC = 34; % Columns in block.
% Figure out the size of each block in rows.
% Most will be blockSizeR but there may be a remainder amount of less than that.
wholeBlockRows = floor(rows / blockSizeR); blockVectorR = [blockSizeR * ones(1, wholeBlockRows), rem(rows, blockSizeR)];% Figure out the size of each block in columns.
wholeBlockCols = floor(columns / blockSizeC); blockVectorC = [blockSizeC * ones(1, wholeBlockCols), rem(columns, blockSizeC)];% Dividing the image into 49 Blocks
ca = mat2cell(X, blockVectorR, blockVectorC); eval(['out_' num2str(l) '=ca' ]); l=l+1; MAPPING=getmapping(8,'riu2'); feature_vector = lbp(ca,1,8,MAPPING,'hist'); feat_vect=feature_vector'; data_matrix = [data_matrix,feat_vect]; end end
Best Answer