Hii, I have a folder of 200 images, I want to extract the LBP features of each image and save them in an Excel sheet so that I can use them as a DB features and retrieve, based on them, the accurate images in a CBIR project. I used this code for the extraction but the output gives me the feature vector of only one image.
image_folder = 'C:\Users\Desktop\images\resized';ext_img = '*.png'; files = dir(fullfile(image_folder, ext_img)); assert(numel(files) > 0, 'No file was found. Check that the path is correct');my_img = struct('img', cell(size(files))); for i = 1:numel(files) Img = imread(fullfile(image_folder, files(i).name));gray = rgb2gray(Img);LBP_image = extractLBPFeatures(gray,'Cellsize',[32 32], 'Normaas i lization','None');numNeigbors = 8 %%Reshape the LBP features into a number of neighbors -by- number of cells array to access histograms for each individual cell.
numBins = numNeigbors*(numNeigbors-1)+3;Cell_Hists = reshape(LBP_image,numBins,[]);Cell_Hists = bsxfun(@rdivide,Cell_Hists,sum(Cell_Hists));%Normalize each LBP cell histogram using L1 norm
LBP_image = reshape(Cell_Hists,1,[]);%Reshape the LBP features vector back to 1-by- N feature vector
end
My second question is how to store them in Excel (in order to have the feature vectors of the 200 images). I used the xlswrite() function but as I said it gives me the vector of only one images (the last one) with a size of 1×3776.
Best Answer