150 likes | 266 Views
Lecture 08 Roger S. Gaborski. Advanced Computer Vision. Histograms. H istogram is nothing more than mapping the pixels in a 2 dimensional matrix into a vector
E N D
Lecture 08 Roger S. Gaborski Advanced Computer Vision Roger S. Gaborski
Histograms • Histogram is nothing more than mapping the pixels in a 2 dimensional matrix into a vector • Each component in the vector is a bin (range of gray level values) and the corresponding value is the number of pixels with that gray level value
Similarity between Histograms • Similarity between histogram bins: • Assuming both histograms have ∑nj j=1…B pixels M. Swain and D. Ballard. “Color indexing,”International Journal of Computer Vision, 7(1):11–32, 1991.
Histogram Intersection • A simple example: • g = [ 17, 23, 45, 61, 15]; (histogram bins) • h = [ 15, 21, 42, 51, 17]; • in=sum(min(h,g))/min( sum(h),sum(g)) • in = 0.9863
>> g = [17,23,45,61,15]; >> h = [15,21,42,51,17]; >> min(g,h) ans= 15 21 42 51 15 >> N = sum(min(g,h)) N = 144 >> D=min(sum(h),sum(g)) D = 146 >> intersection = N/D intersection = 0.9863 Roger S. Gaborski
If Histograms Identical • g = 15 21 42 51 17 • h = 15 21 42 51 17 • >> in=sum(min(h,g))/min( sum(h),sum(g)) • in = 1
Different Histograms • h = 15 21 42 51 17 • g = 57 83 15 11 1 • >> in=sum(min(h,g))/min( sum(h),sum(g)) • in = 0.4315
Region and Histogram Similarity with itself: >>h = hist(q(:),256); >> g=h; >> in=sum(min(h,g))/min( sum(h),sum(g)) in = 1
>> r=236;c=236; >> g=im(1:r,1:c); >> g= hist(g(:),256); >> in=sum(min(h,g))/min( sum(h),sum(g)) in = 0.5474
Partial Matches >> g= hist(g(:),256); >> in=sum(min(h,g))/min( sum(h),sum(g)) in = 0.8014 in=sum(min(h,g))/min( sum(h),sum(g)) in = 0.8566
Lack of Spatial Information • Different patches may have similar histograms
For Howard Ross Roger S. Gaborski