Может ли кто-нибудь помочь мне решить эту проблему? Я использую учебник, и мой код такой же, как у инструктора, код должен сделать область треугольника белым (area_of_interest) и отобразить ее.
Traceback (most recent call last):
File "lanes.py", line 32, in <module>
cv2.imshow('result',region_of_interest(canny) )
File "lanes.py", line 15, in region_of_interest
cv2.fillPoly(mask , polygons , 255 )
TypeError: pts data type = 17 is not supported
код
import cv2
import numpy as np
import matplotlib.pyplot as plt
def canny(image):
gray = cv2.cvtColor(image , cv2.COLOR_RGB2GRAY )
blur = cv2.GaussianBlur(gray , (5,5) , 0 ) # each pixel intensity is the mean weight of the two adgacent ones
canny = cv2.Canny(blur , 50 , 150 ) # 1:3 ratio
return canny
def region_of_interest(image) :
height = image.shape[0]
polygons = np.array([[(200,height),(1100,height),550 ]])
mask = np.zeros_like(image)
cv2.fillPoly(mask , polygons , 255 )
return mask
color channel instead of all R,G,B channels
image = cv2.imread('test_image.jpg') # read an image as a 2 dimentional array of each pixle indintity
lane_image = np.copy(image) # a copy of the image object ( array of numeric values )
canny = canny(lane_image)
cv2.imshow('result',region_of_interest(canny) )
cv2.waitKey()
Я прочитал предыдущие ответы, но все еще не могу решить проблему: \