s1083504 作業6
題目敘述:Run-Length Based Image Compression 練習
附件中為三張利用將晶片高度以色彩視覺化後的圖片。
請設計一個基於Run-Length 的壓縮法方,對圖檔作無失真壓縮後儲存成新檔案。
部落格上應敘述你的壓縮方法,提供壓縮檔之格式,並計算三張圖的平均壓縮率
(compression ratio)。
開發環境
OS: Windows 11
Editor: PyCharm 2022
Language: Python
Package: OpenCV - 4.7.0
程式說明
(1) Compress the image
Read the image
Flatten the image into a 1D array
Run-Length encoding
Save the encoded data as a text file
(2) Calculate compression ratio
程式執行結果
留言
張貼留言