Prev: shift direction using correlation
Next: regexprep
From: Chris Schwarz on 23 Dec 2009 06:25 Hi everyone! I am trying to implement the Tanengrad algorithm in matlab. It is a quantitative measure of the quality of an image (contrast). I took some pictures from papers, where this method is discussed, to have compareable measurements . (http://books.google.de/books?id=Phlog9JD-uQC&pg=PA73&lpg=PA73&dq=tenengrad+value&source=bl&ots=fg4_vYXLMz&sig=iXg4CMSXl0GAOzGawKXInGj8qGA&hl=de&ei=BcIxS4i7CIX4mgPv0KzPBA&sa=X&oi=book_result&ct=result&resnum=10&ved=0CEYQ6AEwCQ#v=onepage&q=tenengrad%20value&f=false page 72) I took lena (http://www.hack4fun.org/h4f/sites/default/files/bindump/lena.bmp) for my experiments. The problem is, that the measurement values are very small - compared to them in literature. This brings me to the idea, that maybe the value-intervall [0,1] is not valid for this method. In literature there are values in the region of 30000, my code give me values in the region of 1,000 e-005. This is what I did allready: function T = tenengrad_value(image, threshold) Sx = [1.0 0.0 -1.0; 2.0 0.0 -2.0; 1.0 0.0 -1.0]; Sy = [1.0 2.0 1.0; 0.0 0.0 0.0; -1.0 -1.0 -1.0]; [m,n,d] = size(image); T = 0.0; if (isrgb(image)) %T = (conv2(Sx,image(:,:,1),'same')^2) + (conv2(Sy,image(:,:,1),'same')^2); %T = T + (conv2(Sx,image(:,:,2),'same')^2) + (conv2(Sy,image(:,:,2),'same')^2); %T = T + (conv2(Sx,image(:,:,3),'same')^2) + (conv2(Sy,image(:,:,3),'same')^2); T = (convn(Sx,image,'same')^2) + (convn(Sy,image,'same')^2); else T = (conv2(Sx,image,'same')^2) + (conv2(Sy,image,'same')^2); end T = (sum(sum(T)); T = (1.0/(m*n)) * T; Thank you very much for your help! Kind regards, Christopher
|
Pages: 1 Prev: shift direction using correlation Next: regexprep |