Ask Your Question

Revision history [back]

cv2.error: (-215)

Hello, I have a problem with OpenCv. I wrote a program on raspberry to detect a line, but I have an cv2.error: (-215)

from picamera.array import PiRGBArray
from picamera import PiCamera
import cv2
import time
import numpy as np
import video

camera = PiCamera()
camera.resolution = (640, 480)
camera.framerate = 32
rawCapture = PiRGBArray(camera, size=(640, 480))

# daem camere razogretsa

time.sleep(0.1)
if __name__ == '__main__':
    def nothing(*arg):
        pass
# hvataem kartinku s cameri

cv2.namedWindow( "result" ) 
hsv_min = np.array((0, 56, 218), np.uint8)
hsv_max = np.array((255, 255, 255), np.uint8)

while True:
    for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):
#berem numpy massiv kotorij predstavlaet kartinku potom zapuskaem 
# timesamp i occupied/unoccupied text
     image = frame.array
     hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV )
     lines = cv2.HoughLinesP(image, 1, np.pi/180, 180,8, 3, 2)
    # clear the stream in preparation for the next frame
     rawCapture.truncate(0)
     thresh = cv2.inRange(hsv, hsv_min, hsv_max)
     cv2.imshow('result', thresh) 
# clear the stream in preparation for the next frame
 ch = cv2.waitKey(1)

cv2.error: (-215)

Hello, I have a problem with OpenCv. I wrote a program on raspberry to detect a line, but I have an cv2.error: (-215)

from picamera.array import PiRGBArray
from picamera import PiCamera
import cv2
import time
import numpy as np
import video

camera = PiCamera()
camera.resolution = (640, 480)
camera.framerate = 32
rawCapture = PiRGBArray(camera, size=(640, 480))

# daem camere razogretsa

time.sleep(0.1)
if __name__ == '__main__':
    def nothing(*arg):
        pass
# hvataem kartinku s cameri

cv2.namedWindow( "result" ) 
hsv_min = np.array((0, 56, 218), np.uint8)
hsv_max = np.array((255, 255, 255), np.uint8)

while True:
    for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):
#berem numpy massiv kotorij predstavlaet kartinku potom zapuskaem 
# timesamp i occupied/unoccupied text
     image = frame.array
     hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV )
     lines = cv2.HoughLinesP(image, 1, np.pi/180, 180,8, 3, 2)
    # clear the stream in preparation for the next frame
     rawCapture.truncate(0)
     thresh = cv2.inRange(hsv, hsv_min, hsv_max)
     cv2.imshow('result', thresh) 
# clear the stream in preparation for the next frame
 ch = cv2.waitKey(1)

cv2.error: (-215)

Hello, I have a problem with OpenCv. I wrote a program on raspberry to detect a line, but I have an cv2.error: (-215)

from picamera.array import PiRGBArray
from picamera import PiCamera
import cv2
import time
import numpy as np
import video

camera = PiCamera()
camera.resolution = (640, 480)
camera.framerate = 32
rawCapture = PiRGBArray(camera, size=(640, 480))

# daem camere razogretsa

time.sleep(0.1)
if __name__ == '__main__':
    def nothing(*arg):
        pass
# hvataem kartinku s cameri

cv2.namedWindow( "result" ) 
hsv_min = np.array((0, 56, 218), np.uint8)
hsv_max = np.array((255, 255, 255), np.uint8)

while True:
    for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):
#berem numpy massiv kotorij predstavlaet kartinku potom zapuskaem 
# timesamp i occupied/unoccupied text
     image = frame.array
     hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV )
     lines = cv2.HoughLinesP(image, 1, np.pi/180, 180,8, 3, 2)
    # clear the stream in preparation for the next frame
     rawCapture.truncate(0)
     thresh = cv2.inRange(hsv, hsv_min, hsv_max)
     cv2.imshow('result', thresh) 
# clear the stream in preparation for the next frame
 ch = cv2.waitKey(1)

error is File "redline.py", line 30, in <module> lines = cv2.HoughLinesP(image, 1, np.pi/180, 180,8, 3, 2) cv2.error: OpenCV(4.1.0-dev) /home/pi/Downloads/opencv-master/modules/imgproc/src/hough.cpp:471: error: (-215:Assertion failed) image.type() == CV_8UC1 in function 'HoughLinesProbabilistic'

cv2.error: (-215)

Hello, I have a problem with OpenCv. I wrote a program on raspberry to detect a line, but I have an cv2.error: (-215)

from picamera.array import PiRGBArray
from picamera import PiCamera
import cv2
import time
import numpy as np
import video

camera = PiCamera()
camera.resolution = (640, 480)
camera.framerate = 32
rawCapture = PiRGBArray(camera, size=(640, 480))

# daem camere razogretsa

time.sleep(0.1)
if __name__ == '__main__':
    def nothing(*arg):
        pass
# hvataem kartinku s cameri

cv2.namedWindow( "result" ) 
hsv_min = np.array((0, 56, 218), np.uint8)
hsv_max = np.array((255, 255, 255), np.uint8)

while True:
    for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):
#berem numpy massiv kotorij predstavlaet kartinku potom zapuskaem 
# timesamp i occupied/unoccupied text
     image = frame.array
     hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV )
     lines = cv2.HoughLinesP(image, 1, np.pi/180, 180,8, 3, 2)
    # clear the stream in preparation for the next frame
     rawCapture.truncate(0)
     thresh = cv2.inRange(hsv, hsv_min, hsv_max)
     cv2.imshow('result', thresh) 
# clear the stream in preparation for the next frame
 ch = cv2.waitKey(1)

error is File "redline.py", line 30, in <module> lines = cv2.HoughLinesP(image, 1, np.pi/180, 180,8, 3, 2) cv2.error: OpenCV(4.1.0-dev) /home/pi/Downloads/opencv-master/modules/imgproc/src/hough.cpp:471: error: (-215:Assertion failed) image.type() == CV_8UC1 in function 'HoughLinesProbabilistic'