072202 - Image Histogram Equalization

題目敘述 Problems Description:

沒錯,又是保羅!由於你幫他完成了圖片的風格轉換後,他又發現圖片好像不是他想要的,他希望能讓圖片的顏色可以平均分散到 0~255 之間,所以請你幫他完成他的需求!

That's right, it's Paul again! Because after you helped him complete the style conversion of the picture, he found that the picture did not seem to be what he wanted. He hopes that the color of the picture can be evenly dispersed between 0~255, so please help him complete his needs!

輸入說明 Input Description:

請在當下路徑的img資料夾中,抓取當下所有附檔名為.tiff.jpg.jpeg的任意大小圖片,並先轉換成黑白之後再依照下方的公式做直方圖均化:

Please find all files with extensions of .tiff, .jpg, .jpeg in the img folder of the current path, and use the following equation to do histogram equalization after converting the photo to gray-level.

h(v)=round(cdf(v)cdfmin(M×N)cdfmin×(L1))h(v) = round(\frac{cdf(v)-cdf_{min}}{(M \times N) - cdf_{min}} \times (L-1))

輸出說明 Output Description:

每張圖都需有:

  • 灰階圖的直方圖

  • 直方圖均化後的灰階圖

  • 均化後之灰階圖的直方圖

而全部的副檔名皆為.png,請存在當下路徑的./img/hist_equal_img資料夾中,並將灰階圖之直方圖的檔名命名為 你的姓名_gray_檔案原始名稱 、均化後之灰階圖命名為 你的姓名_equal_檔案原始名稱 ,以及質方圖的檔名命名為 你的姓名_hist_檔案原始名稱

For each picture, you need to output:

  • the histogram figure of the grayscale picture

  • the grayscale picture after histogram equalization

  • the histogram figure of the grayscale picture after histogram equalization

Besides, all of their extension name are .png. Please save in the ./img/hist_equal_img of the current path, and give the histogram figure of the grayscale picture name to your name_gray_original name, give the grayscale picture after histogram equalization name to your name_equal_original name, and give the histogram figure of the grayscale picture after histogram equalization name to your name_hist_original name.

輸入範例 Input Example:

輸出範例 Output Example:

提示 Hint:

最后更新于

这有帮助吗?