Starting from:

$25

CSGY6643 Assignment 1 Solved

A) Programming Questions 
 

The purpose of this project is to get familiar with the coding environment for the rest of the course, reading/writing images, displaying images, and making graphs. You will implement histogram equalization.

 

Hint for implementation: You can assume an intensity range [0-255] and hardcode the size of the histogram to be 256. You can make sure you have an image of type uint8 with min 0 and max 255 with the python code:

 

# Convert the image to type uint8 and scale intensity values to the range 0-255 

# *Note* numpy min/max flatten the 2D array, so you obtain the min/max of the entire image im_uint8 = ((im - np.min(im)) * (1/(np.max(im) - np.min(im)) * 255)).astype('uint8') 

  

A1) Histogram Equalization
 

Implement histogram equalization and apply to image crowd.png, which you will find uploaded on NYUClasses. You may use the programming environment of your choice. However, we recommended Matlab, Python, and C++, as these are languages we can best support. You are encouraged to use libraries/built in functions to read/and write images and display figures and graphs, but the rest of the implementation must be your own. That specifically includes creating an image histogram (probability density function), computing the corresponding cumulative distribution function (CDF), and the creation of a new contrast adjusted image.

 

Implement the following functions:

 

def create_pdf(im_in): 

        # Create normalized intensity histogram from an input image       return pdf 

 

def create_cdf(pdf): 

        # Create the cumulative distribution function from an input pdf       return cdf 

 

def histogram_equalization(im_in): 

        pdf = create_pdf(im_in) # Your previously implemented function      cdf = create_cdf(pdf) # Your previously implemented function       # Create a histogram equalized image using your computed cdf         return equalized_im

 

Write up a report including the following:

 

•       Include a brief introduction and description of how histogram equalization works.  

 

•       Show crowd.png before and after histogram equalization, and the corresponding histograms (PDFs).

  

•       Discuss how the image and histogram have changed, and connect it back to your description in 1).

 

•       Show the cumulative distribution function before and after histogram equalization on the same figure. Describe what you see. Explain the shape of each CDF and relate it back to image contrast and intensity histogram shape.

 

•       Reapply the histogram equalization procedure on the corrected image. Show and discuss the results.

 

•       Apply histogram equalization to another low contrast image (greyscale). Show and discuss the results.

 

•       Histogram equalization is a global solution, modifying contrast with respect to the CDF of the entire image. Imagine you split the image into smaller regions (e.g. patches of 50x50 pixels) and apply histogram equalization to each local patch independently. In your own words, describe advantages and disadvantages of this strategy. There are no right or wrong answers here, the idea is to think critically about the method and answer honestly in your own words.

 

•       Include all code as an appendix, i.e. copy and paste all your code at the end of your report.

More products