Suggestion required for the implementation of this MATLAB code

Status
Not open for further replies.

shashipoddar

Member level 2
Joined
Oct 1, 2009
Messages
52
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
chennai
Activity points
1,608
I have coded this in my way and would like to have your suggestion if it is correct or not as i am unable to verify the same.

Ref:
A. Beghdadi and A. L. Negrate, “Contrast enhancement technique based on local detection of edges,” Comput. Vis. Graph. Image Process., vol. 46, no. 2, pp. 162–174, May 1989.

The easier representation of the below algorithm is also presented in page no. 7/9 of this paper. https://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5957283&tag=1

First of all we calculate c(i, j) for each pixel of an image I, given by equation below.

c(i,j)=|I(i,j)-E(i,j)|/|I(i,j)+E(i,j)| (18) Where the mean edge gray level is
e(i,j)=∑ g(k,l)x(k,l)/ ∑ g(k,l)
The summation is done for (k,l) being an element of N(i,j). N(i,j) is the set of all neighboring pixels of pixel(i,j) and g(k,l) is the edge value at pixel (k,l). Without loss of generality, 3 X 3 neighborhood is employed, and g(k,l) is estimated using the sobel operators.

The EBCM for image considered is

EBCM= ∑ ∑ c(i,j)/(H*W); where the summation is done for i=1:H, j=1:W.

I am attaching my code. Kindly let me know if i need to change something. I have purposely normalized the image initially so that it is easy to use.

My code:

function EB=EBCM(I_prop1)
[m,n]=size(I_prop1);
h_sob=fspecial('sobel');
I_prop1_norm=double(I_prop1./255);
I_filt_norm=imfilter(I_prop1_norm,h_sob,'replicate');
gij_xij=(I_prop1_norm).*(I_filt_norm);
h_avg=fspecial('average'); %%%default size is 3 by 3
I_filt_avg=imfilter(I_filt_norm,h_avg,'replicate');
gij_xij_avg=imfilter(gij_xij,h_avg,'replicate');
eij=(gij_xij_avg./(I_filt_avg+0.0001));
cij=abs(I_prop1_norm-eij)./abs(I_prop1_norm+eij+0.0001);
cij_u=sum(sum(uint8(round(cij*255))));
EB=cij_u/(m*n); end

Plz let me know if it is worngly implemented

Thanks and regards
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…