I am trying to create a basic image detector with open cv. I am using ORB, I try to open an image and then I try to detect keypoints in the image. Here is my code
import cv2 from cv2 import ORB image1 = cv2.imread("original.jpg", cv2.IMREAD_GRAYSCALE) orb = ORB() # find the keypoints with ORB kp = orb.detect(image1, None)
However when I run my code the program crashes with the following error
Process finished with exit code -1073741819 (0xC0000005)
I search for this error and I found out that this is a memory access violation but I dont know where there it could be a violation?
I got the same error. After some searching I got that
ORB_create() instead of
ORB() fixes it.
outImage error fix,
import numpy as np import cv2 from matplotlib import pyplot as plt img = cv2.imread('extra/sample.jpg',0) ## ERROR #orb = cv2.ORB() ## FIX orb = cv2.ORB_create() # find the keypoints with ORB kp = orb.detect(img,None) # compute the descriptors with ORB kp, des = orb.compute(img, kp) ## ERROR #img2 = cv2.drawKeypoints(img,kp,color=(0,255,0), flags=0) ## Use This or the one below, One at a time #img2 = cv2.drawKeypoints(img, kp, None, flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS) img2 = cv2.drawKeypoints(img, kp, outImage = None, color=(255,0,0)) plt.imshow(img2),plt.show()
User contributions licensed under CC BY-SA 3.0