072201 - Image Color Conversion
最后更新于
这有帮助吗?
最后更新于
这有帮助吗?
保羅是位十分喜歡復古風的攝影師菜鳥,他想把她所有拍到的照片全部轉成復古的黑白照,但她卻沒有工具能將它拍到的所有彩色照片變成她想要的黑白照,請你幫他寫一個能將圖片輸入後,自動轉成帶有復古風的黑白照片。
Paul is a rookie photographer who likes retro style very much. He wants to convert all his photos into retro gray-level photos, but he doesn't have any tools to convert. Please help him write a program that can convert retro-style gray-level photos after inputting any size of the picture.
請在當下路徑的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 convert the photo from color-level to gray-level.
數個副檔名為.png
的灰階圖,請存在當下路徑的./img/gray_img
資料夾中,並將灰階圖的檔名命名為 你的姓名_檔案原始名稱 。
Several grayscale pictures with extension name .png
, please save them in the ./img/gray_img
folder of the current path, and name them your name_original file name.
灰階圖片是由二維陣列構成的,且每個值介於0~255之間,其表示每個點的顏色程度,0維黑色,255維白色,而彩色圖與灰階圖的差別是多使用一個維度來分別表示R、G、B三種不同顏色,請使用Numpy library
和OpenCV library
來處理。
The grayscale image is composed of a two-dimensional array, and each value is between 0 and 255, which indicates the degree of the color of each point, 0 is black, 255 is white, and the difference between color image and the grayscale image is that use one more dimension to represent the three different colors of R, G, and B. Please use Numpy library
and OpenCV library
to process.