---
# System prepended metadata

title: Untitled

---

## Histogram Equalization (CV Lab 2 Question 4)
```
J= np.zeros((I.shape[0],I.shape[1]))
pixel = []
pixelProb = []
x = I.shape[0]
y = I.shape[1]
dim = x * y
for m in range(0,x):          
  for n in range(0,y):
    pixel.append(I[m,n][0])

for i in range(256):          
  pixelProb.append(float(pixel.count(i) / dim))

for m in range(0,x):          
  for n in range(0,y):
    J[m,n] = 255 * (sum(pixelProb[:(I[m,n][0] + 1)]))

print('Histogram Equalized Image')
cv2_imshow(J)
```