I have opencv 4.1.2 installed on pi3B+ with a picamera connected and I am trying to use cv2 to find contours in delta image frame; here's the traceback that I get if cv2.contourArea(c) < conf["min_area"]: TypeError: Expected Ptr<cv::umat> for argument '%s'
Here's the code snippet that throws the above Traceback:
threshold delta image, dilate threshold image to fill in holes, then find contours on threshold image
thresh = cv2.threshold(frameDelta, conf["delta_thresh"], 255, cv2.THRESH_BINARY)[1]
thresh = cv2.dilate(thresh, None, iterations=2)
cnts = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
loop over contours
for c in cnts: #if contour is too small, ignore it if cv2.contourArea(c) < conf["min_area"]: continue
# compute bounding box for contour, draw it on the frame and update text
(x, y, w, h) = cv2.boundingRect(c)
cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)
text = "Occupied"
Is it a bug in cv 4.1.2? I noticed a similar bug was fixed in version 3.4 (#15834). If yes, will the fix be merged in opencv 4.1.2?