s1083513 作業5
一、作業主題: 膚色偵測 Skin Color Detection
利用你所學的 顏色(Color)的知識與技術,撰寫一個程式來偵測一張輸入照片中的皮膚區域並將其標示出。(請用附件中的三張照片做測試)
Write a program that detect skin color from an image.
二、開發環境
Windows
10 / Visual Studio 2022 C++ / OpenCV 4.7.0
三、實作方法
1. imread() 讀取三張圖像
2. 使用 cvtColor(),將圖像從 RGB 轉成 HSV
3.
將膚色區域分離出來
(1) 使用 inRange()設定閾值,保留皮膚部分
#1st range of Hue
lower -> [0, 48,
50]
upper -> [30, 255, 255]
#2nd
range of Hue (OpenCV converts 360 to 180)
lower2 -> [172,
20, 50]
upper2 -> [180, 255, 255]
(2) 用GaussianBlur()使圖片平滑模糊化
(3) 使用 bitwise_and()、bitwise_or()進行圖像合成,印出結果
四、執行結果
留言
張貼留言