Not able to counter the error Ptr<cv::UMat> for argument '%s'

i am trying my level best to counter implement the code in third last video of 22mins but i am again and again recieving the error as :
TypeError:Expected Ptrcv::UMat for argument ‘%s’

Just cross check if anywhere you are reading an image file using “imread” function of cv2, and the path specified by you for the image is correct or not.
Share your code snippet if still the doubt persists.

There is mistake while you are specifying path.
in line 18 replace “E:\CB-Archives\m” with “E:/CB-Archives/m”
If the error persists, try replacing all “\” with “\\” wherever you are specifying path.

tried replacing the ‘’ with’/’ but error still remains the same , the following is the rest of the code continuing the above code…

, out of 100% only 10% of times the code runs fine and rest of the time it shows the same error ie TypeError:Expected Ptrcv::UMat for argument ‘%s’

Plz share the complete code file, so that i can copy it and run it on my system.

can you plz specify the way that how can i send the complete code file?

The easiest way is just upload your ipynb file on your drive and make it sharable, and share the link here.

https://drive.google.com/file/d/1HaCdXrtxZhCARcf_AmtjwVsvrQl4WdSJ/view?usp=sharing

The line in which in you are initializing “face_section=[]” is causing the error.
To correct this, just replace it with
"face_section = np.ones((100,100))255.0"
This line just makes 100
100 numpy array having 255.0 in each cell, actually 255.0 corresponds to white color on grayscale. And this needs to be done so that if no face_section is initialized than it would not contain an empty list. And that is why as you said only 10% of time it runs and fails in rest. That’s the reason.
So just change this And then your code would work fine.

Hope this cleared your doubt. :blush:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.