OpenCV的 60 種圖像效果,一篇文章搞定

點擊上方AI算法與圖像處理”,選擇加"星標"或“置頂

重磅乾貨,第一時間送達


    
    
    

推薦閱讀

31個Python實戰項目教你掌握圖像處理,PDF開放下載

opencv_contrib擴展模塊中文教程pdf,限時領取


最近在B站看到一個視頻關於OpenCV 中的60 種,圖像處理,總結的非常棒,因此分享給小夥伴們!

項目:https://github.com/dyh/opencv_tools

接下來我們詳細看一下這個項目中到底包含了哪些內容。

一分鐘視頻:

圖像色彩

image_color.py

  • 色度/色調

  • 飽和度

  • 純度/亮度

  • 固定飽和度s

  • 固定亮度v

  • 固定色度h + 固定飽和度s

  • 固定色度h + 固定亮度v

  • 固定飽和度s + 固定亮度v


圖像變換

image_transformation.py

  • 形態學濾波器腐蝕和膨脹圖像

  • 腐蝕 3x3

  • 膨脹 3x3 3次

  • 腐蝕 7x7

  • 腐蝕 3x3 3次

  • 形態學濾波器開啓和閉合圖像

  • Close the image

  • Open the image

  • 灰度圖像中應用形態學運算 Gradient | Edge

  • Apply threshold to obtain a binary image

  • 7x7 Black Top-hat Image

  • Apply threshold to obtain a binary image

  • Apply the black top-hat transform using a 7x7 structuring element

圖像濾波器

image_filtering.py


  • Blur the image with a mean filter

  • Blur the image with a mean filter 9x9

  • 縮減 採樣

  • resizing with NN

  • resizing with bilinear

  • 中值濾波

  • 定向濾波器

  • Compute Sobel X derivative

  • Compute Sobel Y derivative

  • Compute norm of Sobel

  • Compute Sobel X derivative (7x7)

  • Apply threshold to Sobel norm (low threshold value)

  • Apply threshold to Sobel norm (high threshold value)

  • down-sample and up-sample the image

  • down-sample and up-sample the image

  • cv2.subtract

  • cv2.subtract gauss15 - gauss05

  • cv2.subtract gauss22 - gauss20

提取直線、輪廓、區域

image_outline.py

  • Canny Contours

  • Canny Contours Gray

  • Hough tranform for line detection

  • Circles with HoughP

  • Get the contours, Contours with RETR_LIST

圖像增強-白平衡等

image_enhancement.py

  • 簡單白平衡

  • 灰度世界算法

  • 直方圖均衡化

  • 視網膜-大腦皮層(Retinex)增強算法

  • Single Scale Retinex

  • Multi Scale Retinex

  • Multi Scale Retinex With Color Restoration

  • 自動白平衡 AWB

  • 自動色彩均衡 ACE

運行環境

python 3.6+,pip 20+

pip install -r requirements.txt

Pillow==8.0.1numpy==1.19.4opencv-python==4.4.0.46six==1.15.0matplotlib==3.3.3cycler==0.10.0kiwisolver==1.3.1pkg-resources==0.0.0pyparsing==2.4.7python-dateutil==2.8.1

如何運行

  1. 克隆代碼

    $ git clone https://github.com/dyh/opencv_tools.git
  2. 進入目錄

    $ cd opencv_tools
  3. 創建 python 虛擬環境

    $ python3 -m venv venv
  4. 激活虛擬環境

    $ source venv/bin/activate
  5. 升級pip

    $ python -m pip install --upgrade pip
  6. 安裝軟件包

    $ pip install -r requirements.txt
  7. 在 main.py 文件中,設置要處理的圖片路徑 file_path,例如

    file_path = './images/000000050145.jpg'
  8. 運行程序

    python main.py
  9. 程序將在 output 目錄下輸出60張圖片

是不是非常的實用

利用現有的工具提高效果,如果對你有幫助,可以給我來三連!

    
         
         
         
       
            
            
            


   
      
      
      
個人微信(如果沒有備註不拉羣!
請註明: 地區+學校/企業+研究方向+暱稱



下載1:何愷明頂會分享


AI算法與圖像處理」公衆號後臺回覆:何愷明,即可下載。總共有6份PDF,涉及 ResNet、Mask RCNN等經典工作的總結分析


下載2:終身受益的編程指南:Google編程風格指南


AI算法與圖像處理」公衆號後臺回覆:c++,即可下載。歷經十年考驗,最權威的編程規範!



 
    
    
    
下載3 CVPR2020

AI算法與圖像處公衆號後臺回覆: CVPR2020 即可下載1467篇CVPR 2020論文


覺得不錯就點亮在看吧


本文分享自微信公衆號 - AI算法與圖像處理(AI_study)。
如有侵權,請聯繫 [email protected] 刪除。
本文參與“OSC源創計劃”,歡迎正在閱讀的你也加入,一起分享。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章