Hi there, I’m the founder of Pysource.
I’m a Computer Vision Consultant, developer and Course instructor.
I help Companies and Developers to build efficient computer vision software.
Sir,
I get the following error….
How to proceed res=cv2.matchTemplate(cap1,template,cv2.TM_CCOEFF_NORMED)
TypeError: image is not a numpy array, neither a scalar
You get this error when you don’t have any image.
Make sure that the image or frame is loaded correctly, just try to display it using cv2.imshow(“cap1”, cap1)
Yes, of course. As we know, to design the rectangle we need 2 points, top left and bottom right and we have both of them just adding with and height to the first point. To draw the circle we would need to get the center point, so we can just add half of the with and half of the height and we get it.
i have a raspberry pi and i need it to work for that.
I need the code to match a template in live video feed using the rpi camera.
can you give me a code for this?
hope one off you can help me i really need it for a demo
hello,
i want two template
template1 = cv2.imread(“pen.png”, cv2.IMREAD_GRAYSCALE)
template2 = cv2.imread(“pen.png”, cv2.IMREAD_GRAYSCALE)
How to matching
****
res = cv2.matchTemplate(gray_frame, template, cv2.TM_CCOEFF_NORMED)
you can help me
my problem
Traceback (most recent call last):
File “C:/Users/win10/OneDrive/xulyanh/thu nghiem.py”, line 6, in
w, h = template.shape[::-1]
AttributeError: ‘NoneType’ object has no attribute ‘shape’
When the Template is present inside Image, then only it shows correct result.When the Template does not present inside Image then it will make rectangle of same size as template(template not found is not handled).How can I check the template is present inside Image or not ?
hi,
I was wondering how you could make a template match if the orientation of the picture is different, e.g. when it is rotated. How could this be achieved.
Sir,
I get the following error….
How to proceed res=cv2.matchTemplate(cap1,template,cv2.TM_CCOEFF_NORMED)
TypeError: image is not a numpy array, neither a scalar
You get this error when you don’t have any image.
Make sure that the image or frame is loaded correctly, just try to display it using cv2.imshow(“cap1”, cap1)
Is it possible to make af circle around template i?
cv2.circle(……)
Yes, of course. As we know, to design the rectangle we need 2 points, top left and bottom right and we have both of them just adding with and height to the first point. To draw the circle we would need to get the center point, so we can just add half of the with and half of the height and we get it.
[python]for pt in zip(*loc[::-1]):
center_point_x = pt[0] + w/2
center_point_y = pt[1] + h/2
cv2.circle(img, (int(center_point_x), int(center_point_y)), int(w/2), (0, 255, 0), -1)
[/python]
hello,
i have a raspberry pi and i need it to work for that.
I need the code to match a template in live video feed using the rpi camera.
can you give me a code for this?
hope one off you can help me i really need it for a demo
hello,
i need the same script for running on a rpi3 with picam
i tried almost everything without succes.
it’s for a project i wanne make.
please help me with the code.
hello,
i want two template
template1 = cv2.imread(“pen.png”, cv2.IMREAD_GRAYSCALE)
template2 = cv2.imread(“pen.png”, cv2.IMREAD_GRAYSCALE)
How to matching
****
res = cv2.matchTemplate(gray_frame, template, cv2.TM_CCOEFF_NORMED)
Help me please.
template2 = cv2.imread(“barts_face.jpg”, cv2.IMREAD_GRAYSCALE)
you can help me
my problem
Traceback (most recent call last):
File “C:/Users/win10/OneDrive/xulyanh/thu nghiem.py”, line 6, in
w, h = template.shape[::-1]
AttributeError: ‘NoneType’ object has no attribute ‘shape’
It means that you’re not loading correctly the template. Make sure that you put the correct file name.
for me i get an invalid syntax error for cv2.imshow(‘img’, img)
please explain looking forward to your reply
When the Template is present inside Image, then only it shows correct result.When the Template does not present inside Image then it will make rectangle of same size as template(template not found is not handled).How can I check the template is present inside Image or not ?
img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.1.1) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function ‘cvtColor’
i guess this error because the image you used not exsits or not in the right folder
hi,
I was wondering how you could make a template match if the orientation of the picture is different, e.g. when it is rotated. How could this be achieved.
sincerly,
Thomas
hi,
How to use template matching if I have more than one template.
I’m looking forward to your response, please.
Thanks,
Nay