9

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?

1
  • 1
    This bug has been reported month ago, but I haven't found a working fix, even if some people report that using cv2.ocl.setUseOpenCL(False) before call work for them... Dec 17, 2020 at 12:21

1 Answer 1

18

I got the same error. After some searching I got that ORB_create() instead of ORB() fixes it.

Sources:

matching error in ORB with opencv 3

outImage error fix,

https://github.com/opencv/opencv/issues/6487

Code:

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()
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.