# HW2 report ## Image enhancement ### (a) Briefly describe how global and local histogram equalization work. What is the difference between global and local histogram equalization? * #### global histogram equalization: first record all pixel value and we can get a histogram stands for the distribution of the pixel value, second map the cumulative probability of every pixel value to the corresponding pixel value which have same cumulative probability. * #### local histogram equalization: similar to global histogram equalization, however we need to define an area (usually an odd by odd such as 5 * 5), iterate through the image with this area and perform histogram equalization in every area. * #### difference To my mind, local histogram equalization is more suitable for image that required better detail at certain area instead of whole image , take following image as example. ![](https://i.imgur.com/TFYnJcz.png) ### (b) Plot the histograms of sample1 and sample2. What is the difference between these two pictures? | sample1 | sample2 | | -------- | -------- | |![](https://i.imgur.com/6IzAXGp.png)| ![](https://i.imgur.com/7H3l6mh.png)| * In sample1, all pixel value are close unlike sample2, which will reduce the contrastment . ## Edge Detection ### (a) Compare sample3 and sample4. What is the difference between these two pictures? Which one do you think performed better? Why? * sample4 have obviously more detail than sample3, and the reason is that the sample4 is the outcome of sample2, which have better contrastment than sample1. ### (b) Are there other ways to obtain a better edge map of sample1? Please provide proper suggestions and describe the steps in detail. 1. First we can reduce some noise by applying some filter such as gauss. 2. Second we can enhance the contrastment by histogram equalization. 3. Perform Canny edge detection. #### Sample with Canny threshold = (50, 255) , both images have perform histogram equalization. | Without Gauss | With Gauss (3, 3) and sigmaX = 0 | | -------- | -------- | | ![](https://i.imgur.com/bgXIGHy.png) | ![](https://i.imgur.com/rLSoFij.png) |