久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

cv2.approxPolyDP() , cv2.arcLength() 這些是如何工作的

cv2.approxPolyDP() , cv2.arcLength() How these works(cv2.approxPolyDP() , cv2.arcLength() 這些是如何工作的)
本文介紹了cv2.approxPolyDP() , cv2.arcLength() 這些是如何工作的的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

這些功能是如何工作的?我正在使用 Python3.7 和 OpenCv 4.2.0.提前致謝.

How do these function works? I am using Python3.7 and OpenCv 4.2.0. Thanks in Advance.

approx = cv2.approxPolyDP(cnt, 0.01*cv2.arcLength(cnt, True), True)

推薦答案

如果您正在尋找示例代碼段,以下是一個:

If you are looking for a example snippet, below is one:

import cv2
import imutils

# edged is the edge detected image
cnts = cv2.findContours(edged, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)
cnts = sorted(cnts, key = cv2.contourArea, reverse = True)[:5]
# loop over the contours
for c in cnts:
    # approximate the contour
    peri = cv2.arcLength(c, True)
    approx = cv2.approxPolyDP(c, 0.02 * peri, True)
    # if our approximated contour has four points, then we
    # can assume that we have found our screen
    if len(approx) == 4:
        screenCnt = approx
        break

在上面的代碼片段中,它首先從邊緣檢測圖像中找到輪廓,然后對輪廓進行排序以找到五個最大的輪廓.最后,它遍歷輪廓并使用 cv2.approxPolyDP 函數(shù)來平滑和逼近四邊形.cv2.approxPolyDP 適用于文檔邊界等輪廓中有尖銳邊緣的情況.

In the above snippet, first it finds the contours from a edge detected image, then it sorts the contours to find the five largest contours. Finally it loop over the contours and used cv2.approxPolyDP function to smooth and approximate the quadrilateral. cv2.approxPolyDP works for the cases where there are sharp edges in the contours like a document boundary.

這篇關(guān)于cv2.approxPolyDP() , cv2.arcLength() 這些是如何工作的的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區(qū)域周圍繪制一個矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個矩形邊界框中應(yīng)用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據(jù)文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: a毛片 | 日韩中文字幕在线 | 成人网视频 | 国产精品久久久久久久岛一牛影视 | 在线视频一区二区 | 日韩精品在线观看一区二区 | 羞羞视频免费观看入口 | 男女视频在线观看网站 | h视频在线播放 | 操久久| 高清久久 | 亚洲精品91| 欧美精品一区二区在线观看 | 欧美久久一区 | 国产成人精品午夜 | 久久国产精99精产国高潮 | 欧美日韩国产精品激情在线播放 | 日韩在线电影 | 视频在线一区二区 | 2022国产精品 | 91精品国产综合久久福利软件 | 中文字幕在线第二页 | 午夜丰满寂寞少妇精品 | 精品国产乱码久久久久久a丨 | 天天干狠狠 | 五月综合色啪 | 欧美一区二区三区在线观看视频 | 午夜精品一区二区三区在线观看 | 国产精品久久久乱弄 | 韩国电影久久 | 亚洲欧美一区二区三区视频 | 久久久久久久久久久福利观看 | 一区二区在线看 | 久草视频网站 | 久久噜噜噜精品国产亚洲综合 | a级在线免费 | 91精品国产91久久久久久 | 国产精品一区二区日韩 | 国产在线视频一区 | 亚洲一区欧美一区 | 成人日韩 |