Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Topic: Neighbor Distribution Center of Mass (NDCOM)
Replies: 1   Last Post: May 16, 2014 7:58 AM

 Messages: [ Previous | Next ]
 Syamsul Posts: 15 Registered: 3/19/11
Neighbor Distribution Center of Mass (NDCOM)
Posted: May 15, 2014 3:59 PM

Hi,

Anyone could help me to calculate the NDCOM for an image? The first part of the calculation was counting the number of pixels that had each intensity level, thus getting one value for each intensity level. The neighborhood distribution was then retrieved by assigning each intensity level a new value, the sum of the two previously
counted number of pixels that had either of the neighboring intensity values (defined as all pixels that have a difference of value of 1 or -1). The extracted value was then the middle point where the accumulated number of neighbor intensity values was the same above and below.

NDCOM calculated separately for each color channel k \in {R,G,B} using histogram h_k = hist(x_k). Some of the equations which might help to understand:

f_ndc = argmin_s d_k[s], where d_k(s) >= 0, k \in {R,G,B}, s \in {1,2,3...253}

d_k[s] = sum_{t1=1}^{s} g_k[t1]) - sum_{t2=2}^{254} (g_k[t2])

g_k[t] = h_k[t-1] + h_k[t+1]

My code:
r = rgb(:,:,1); g = rgb(:,:,2); b = rgb(:,:,3);

%Neighbor distribution centre of mass (for example: r channel only)
hk = imhist(r); %count the number of pixels per intensity level [0..255]
gk_t1 = sum((hk(2:254)-hk(1:253)) + (hk(2:254)+hk(3:255))); %hk[t-1]+hk[+1]
gk_t2 = sum((hk(3:255)-hk(2:254)) + (hk(3:255)+hk(4:256))); %hk[t-1]+hk[+1]

dk_s = gk_t1 - gk_t2;
argMin_ds = find(ds==min(ds(find(ds>=0))));

I'm not sure whether my code is correct or not. If anyone has better understanding on this, you help is really appreciated.

Thank you.
Syam

Date Subject Author
5/15/14 Syamsul
5/16/14 Syamsul