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

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

如何使用 OpenCV Python 檢測(cè)對(duì)象的邊緣點(diǎn)?

如何使用 OpenCV Python 檢測(cè)對(duì)象的邊緣點(diǎn)?

人到中年有點(diǎn)甜 2021-11-02 16:45:03
所以,我已經(jīng)檢測(cè)到一個(gè)對(duì)象的所有邊緣,但問(wèn)題是我找不到每個(gè)邊緣的兩個(gè)點(diǎn),即起點(diǎn)和終點(diǎn)及其坐標(biāo)。實(shí)際上,我正在嘗試找到對(duì)象的測(cè)量值,但我被困在這個(gè)問(wèn)題上。import cv2import numpy as npfrom matplotlib import pyplot as plt #Read Image of the Objectimg = cv2.imread("C:\\Users\\Desktop\\Project\\captured.jpg")cv2.imshow('Original Image', img)cv2.waitKey(0)#Convert Image To GrayScalegray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)cv2.imshow('Gray', gray)cv2.waitKey(0)#Binary Thresholdingret, thresh = cv2.threshold(gray, 150, 255, cv2.THRESH_BINARY_INV)cv2.imshow('Binary Image', thresh)cv2.waitKey(0)#Crop Imagecropped = thresh[150:640, 150:500]cv2.imshow('Cropped Image', cropped)cv2.waitKey(0)#Edge Detectionedges = cv2.Canny(cropped, 100, 200)cv2.imshow('Edges', edges)cv2.waitKey(0)#find contoursctrs, hier = cv2.findContours(cropped, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)#Sort Contourssorted_ctrs = sorted(ctrs, key=lambda ctr: cv2.boundingRect(ctr)[0] + cv2.boundingRect(ctr)[1] * cropped.shape[1])#ROIfor i, ctr in enumerate(sorted_ctrs):    # Get bounding box    x, y, w, h = cv2.boundingRect(ctr)    # Getting ROI    roi = cropped[y:y + h, x:x + w]    # show ROI    # cv2.imshow('segment no:'+str(i),roi)    cv2.rectangle(cropped , (x, y), (x + w, y + h), (150, 0, 255), 2)cv2.imshow('marked areas', cropped)cv2.waitKey(0)這些是我需要的 5 個(gè)點(diǎn)和 5 個(gè)邊,它們帶有坐標(biāo),因此我可以計(jì)算它們之間的距離以進(jìn)行測(cè)量。
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 245 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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