日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【CV】图像分析用 OpenCV 与 Skimage,哪一个更好?

發布時間:2025/3/12 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【CV】图像分析用 OpenCV 与 Skimage,哪一个更好? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

這兩種算法在它們可以檢測到的和不能檢測到的方面都有其起伏。

OpenCV 是用 C++ 在后端進行編程的,并作為一個機器學習包,來分析 Python 中的圖像模式。

Skimage 也稱為 Scikit-Image ,是一個機器學習軟件包,用于圖像預處理以發現隱藏模式。


兩者的最佳平臺

OpenCV 建議在基于服務器的 notebook 上完成,比如 google colab,或者 google cloud、Azure cloud 甚至 IBM 中的 notebook 擴展。

而對于 Skimage 來說,即使是 Jupyter Lab/Notebooks 也能很好地工作,因為它在處理上沒有 OpenCV 那么復雜。

使用 Skimage 分析面部數據的 Python 代碼

from skimage import data from skimage.feature import Cascadeimport matplotlib.pyplot as plt from matplotlib import patches# Load the trained file from the module root. trained_file = data.lbp_frontal_face_cascade_filename()# Initialize the detector cascade. detector = Cascade(trained_file)img = data.astronaut()detected = detector.detect_multi_scale(img=img,scale_factor=1.2,step_ratio=1,min_size=(60, 60),max_size=(90, 500))plt.imshow(img) img_desc = plt.gca() plt.set_cmap('gray')for patch in detected:img_desc.add_patch(patches.Rectangle((patch['c'], patch['r']),patch['width'],patch['height'],fill=False,color='r',linewidth=2))plt.show()

# We have detected a face using Skimage in python # Obtain the segmentation with default 100 regions segments = slic(img)# Obtain segmented image using label2rgb segmented_image = label2rgb(segments, img, kind=’avg’)# Detect the faces with multi scale method detected = detector.detect_multi_scale(img=segmented_image, scale_factor=1.2, step_ratio=1, min_size=(10, 10), max_size=(1000, 1000))# Show the detected faces show_detected_face(segmented_image, detected)


因此我們在這里看到了如何使用 python 中的 Skimage 檢測人臉和推斷圖像。

使用?OpenCV 分析數據的 Python 代碼

from google.colab import drive drive.mount('/content/drive') image = cv2.imread(r'/content/drive/MyDrive/12-14-2020-tout.jpg') # check properties of the image image.shape # This image has 1333 pxl width, 2000 pxl height and 3 channels(red, green, blue) from google.colab.patches import cv2_imshow cv2_imshow(image)

這里我們使用OpenCV上傳了一張圖片:

eye_detector = cv2.CascadeClassifier('/content/drive/MyDrive/haarcascade_frontalcatface.xml') eye_detections = eye_detector.detectMultiScale(image) eye_detections # detect face with eyes on one of the faces eye_detections = eye_detector.detectMultiScale(image) for (x,y,w,h) in eye_detections: cv2.rectangle(image, (x,y), (x+w, y+h), (0,300,0), 2) cv2_imshow(image)

在這里,我們使用 OpenCV 中的 Hascade 參數技術檢測了其中一張人臉,該技術也可以調整以檢測所有人臉。

往期精彩回顧適合初學者入門人工智能的路線及資料下載機器學習及深度學習筆記等資料打印機器學習在線手冊深度學習筆記專輯《統計學習方法》的代碼復現專輯 AI基礎下載黃海廣老師《機器學習課程》視頻課黃海廣老師《機器學習課程》711頁完整版課件

本站qq群955171419,加入微信群請掃碼:

總結

以上是生活随笔為你收集整理的【CV】图像分析用 OpenCV 与 Skimage,哪一个更好?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。