Tuesday, 15 June 2010

Improving Performance of Content-Based Image Retrieval using Color Histograms in MATLAB -



Improving Performance of Content-Based Image Retrieval using Color Histograms in MATLAB -

i working on content-based image retrieval , precision-recall graphs using color histograms in matlab. since, have 1000 images in database. when query input image takes around 12 seconds execute , show pr curve. curious know that, how improve performance?

code:

% dir: parent directory location images folder c1, c2, c3 % inputimage: \c1\1.ppm % illustration p-r curve execute: cbir('d:\visionimages','\c2\1.ppm'); function [ ] = democbir( dir,inputimage) % dir='d:\visionimages'; % inputimage='\c3\1.ppm'; tic; s=strcat(dir,inputimage); inp1=imread(s); num_red_bins = 8; num_green_bins = 8; num_blue_bins = 8; num_bins = num_red_bins*num_green_bins*num_blue_bins; = imcolourhist(inp1, num_red_bins, num_green_bins, num_blue_bins);%input image histogram srcfiles = dir(strcat(dir,'\*.jpg')); b = zeros(num_bins, 100); % hisogram of other 100 images in category 1 ptr=1; = 1 : length(srcfiles) filename = strcat(dir,'\',srcfiles(i).name); = imread(filename);% filter image b(:,ptr) = imcolourhist(i, num_red_bins, num_green_bins, num_blue_bins); ptr=ptr+1; end %normal histogram intersection = size(a,2); b = size(b,2); k = zeros(a, b); = 1:a va = repmat(a(:,i),1,b); k(i,:) = 0.5*sum(va + b - abs(va - b)); end %pr curve creation sims=k; i=1: 100 % number of relevant images dir 1 relevant_ids(i) = i; end num_relevant_images = numel(relevant_ids); [sorted_sims, locs] = sort(sims, 'descend'); locations_final = arrayfun(@(x) find(locs == x, 1), relevant_ids); locations_sorted = sort(locations_final); precision = (1:num_relevant_images) ./ locations_sorted; recall = (1:num_relevant_images) / num_relevant_images; plot(recall, precision, 'b.-'); xlabel('recall'); ylabel('precision'); title('precision-recall graph'); axis([0 1 0 1.05]); grid; toc; end

elapsed time 12.700687 seconds.

matlab image-processing computer-vision matlab-cvst

No comments:

Post a Comment