1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        圖像分析用 OpenCV 與 Skimage,哪一個(gè)更好?

        共 3300字,需瀏覽 7分鐘

         ·

        2021-12-14 21:01

        點(diǎn)擊上方小白學(xué)視覺(jué)”,選擇加"星標(biāo)"或“置頂

        重磅干貨,第一時(shí)間送達(dá)

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


        OpenCV 是用 C++ 在后端進(jìn)行編程的,并作為一個(gè)機(jī)器學(xué)習(xí)包,來(lái)分析 Python 中的圖像模式。


        Skimage 也稱為 Scikit-Image ,是一個(gè)機(jī)器學(xué)習(xí)軟件包,用于圖像預(yù)處理以發(fā)現(xiàn)隱藏模式。


        兩者的最佳平臺(tái)

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


        而對(duì)于 Skimage 來(lái)說(shuō),即使是 Jupyter Lab/Notebooks 也能很好地工作,因?yàn)樗谔幚砩蠜](méi)有 OpenCV 那么復(fù)雜。


        使用 Skimage 分析面部數(shù)據(jù)的 Python 代碼
        from skimage import datafrom skimage.feature import Cascade
        import matplotlib.pyplot as pltfrom 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 regionssegments = slic(img)
        # Obtain segmented image using label2rgbsegmented_image = label2rgb(segments, img, kind=’avg’)
        # Detect the faces with multi scale methoddetected = 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 facesshow_detected_face(segmented_image, detected)

        因此我們?cè)谶@里看到了如何使用 python 中的 Skimage 檢測(cè)人臉和推斷圖像。


        使用?OpenCV 分析數(shù)據(jù)的 Python 代碼


        from google.colab import drivedrive.mount('/content/drive')image = cv2.imread(r'/content/drive/MyDrive/12-14-2020-tout.jpg')# check properties of the imageimage.shape# This image has 1333 pxl width, 2000 pxl height and 3 channels(red, green, blue)from google.colab.patches import cv2_imshowcv2_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 faceseye_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 參數(shù)技術(shù)檢測(cè)了其中一張人臉,該技術(shù)也可以調(diào)整以檢測(cè)所有人臉。


        下載1:OpenCV-Contrib擴(kuò)展模塊中文版教程
        在「小白學(xué)視覺(jué)」公眾號(hào)后臺(tái)回復(fù):擴(kuò)展模塊中文教程,即可下載全網(wǎng)第一份OpenCV擴(kuò)展模塊教程中文版,涵蓋擴(kuò)展模塊安裝、SFM算法、立體視覺(jué)、目標(biāo)跟蹤、生物視覺(jué)、超分辨率處理等二十多章內(nèi)容。

        下載2:Python視覺(jué)實(shí)戰(zhàn)項(xiàng)目52講
        小白學(xué)視覺(jué)公眾號(hào)后臺(tái)回復(fù):Python視覺(jué)實(shí)戰(zhàn)項(xiàng)目,即可下載包括圖像分割、口罩檢測(cè)、車(chē)道線檢測(cè)、車(chē)輛計(jì)數(shù)、添加眼線、車(chē)牌識(shí)別、字符識(shí)別、情緒檢測(cè)、文本內(nèi)容提取、面部識(shí)別等31個(gè)視覺(jué)實(shí)戰(zhàn)項(xiàng)目,助力快速學(xué)校計(jì)算機(jī)視覺(jué)。

        下載3:OpenCV實(shí)戰(zhàn)項(xiàng)目20講
        小白學(xué)視覺(jué)公眾號(hào)后臺(tái)回復(fù):OpenCV實(shí)戰(zhàn)項(xiàng)目20講,即可下載含有20個(gè)基于OpenCV實(shí)現(xiàn)20個(gè)實(shí)戰(zhàn)項(xiàng)目,實(shí)現(xiàn)OpenCV學(xué)習(xí)進(jìn)階。

        交流群


        歡迎加入公眾號(hào)讀者群一起和同行交流,目前有SLAM、三維視覺(jué)、傳感器、自動(dòng)駕駛、計(jì)算攝影、檢測(cè)、分割、識(shí)別、醫(yī)學(xué)影像、GAN、算法競(jìng)賽等微信群(以后會(huì)逐漸細(xì)分),請(qǐng)掃描下面微信號(hào)加群,備注:”昵稱+學(xué)校/公司+研究方向“,例如:”張三?+?上海交大?+?視覺(jué)SLAM“。請(qǐng)按照格式備注,否則不予通過(guò)。添加成功后會(huì)根據(jù)研究方向邀請(qǐng)進(jìn)入相關(guān)微信群。請(qǐng)勿在群內(nèi)發(fā)送廣告,否則會(huì)請(qǐng)出群,謝謝理解~


        瀏覽 55
        點(diǎn)贊
        評(píng)論
        收藏
        分享

        手機(jī)掃一掃分享

        分享
        舉報(bào)
        評(píng)論
        圖片
        表情
        推薦
        點(diǎn)贊
        評(píng)論
        收藏
        分享

        手機(jī)掃一掃分享

        分享
        舉報(bào)
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            日本护士老师的毛茸茸 | 亚洲色情电影 | 成人无码HAV在线看免费 | 激情午夜网 | 日本三级放荡的护士 | 福利视频亚洲 | 中文字幕第一页在线 | 美女视频黄a视频美女大全 | 欧美在线va | 免费国产在线视频 |