Ask Your Question

isjosan's profile - activity

2020-11-11 02:10:36 -0600 received badge  Famous Question (source)
2020-05-17 10:36:49 -0600 received badge  Notable Question (source)
2020-04-02 10:56:39 -0600 received badge  Popular Question (source)
2020-01-03 06:34:53 -0600 received badge  Teacher (source)
2020-01-03 06:34:53 -0600 received badge  Self-Learner (source)
2019-12-27 10:42:13 -0600 marked best answer opencv 4.1.2 - TypeError: Expected Ptr<cv::UMat> for argument '%s'

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?

2019-12-27 10:30:37 -0600 commented answer opencv 4.1.2 - TypeError: Expected Ptr<cv::UMat> for argument '%s'

I fixed my code to use tuple returned by findContours(); that has fixed my issue with motion detection code in OpenCv 4.

2019-12-25 20:25:22 -0600 asked a question opencv 4.1.2 - TypeError: Expected Ptr<cv::UMat> for argument '%s'

opencv 4.1.2 - TypeError: Expected Ptr<cv::umat> for argument '%s' I have opencv 4.1.2 installed on pi3B+ with a p