第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

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

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

qq_笑_17 2023-01-04 11:08:02
這些功能如何工作?我正在使用 Python3.7 和 OpenCv 4.2.0。提前致謝。approx = cv2.approxPolyDP(cnt, 0.01*cv2.arcLength(cnt, True), True)
查看完整描述

1 回答

?
慕田峪7331174

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超13個(gè)贊

如果您正在尋找一個(gè)示例片段,下面是一個(gè):


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

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


查看完整回答
反對 回復(fù) 2023-01-04
  • 1 回答
  • 0 關(guān)注
  • 240 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號