- Looking for word frequency data for the Google Books ngrams
- CME SDL WEB - Modify behaviour select item
- “had been suspended” In Google Serch
- Is “too few” equivalent to “not enough”?
- What is the name of the question part in the conditional sentences?
- Present Continuous (personal initiative), Present Simple (a voice of authority)?
- Financial limitation or financial capacity
- Jump or Jump over
- Who is/ are your favourite band?
- Is it possible for a clause to be reduced when it uses the verb “to be”?
- I have server without console ssh, how Can I work with Magento?
- How to get current Store Home URL outside of Magento (1.9)?
- Multiple select product attribute is not showing in front end
- Override Sales order history issue in magento2
- Magento 2 Admin Grid Add/Update Button
- Advanced search in sidebar categories
- Quotes show twicely on check out (shipping info) in magento 1.9
- Magento2 : How to show success message in checkout page on page load
- Magento EE - Can not install patch EE-188.8.131.52-184.108.40.206-2018-09-17-05-45-48.diff
Motor driving using template matching using python and opencv on Rapberry pi
I want to drive a motor when my template is matched, I have written code of template matching but can't figure out how to drive the motor with it.
This is my code:
import numpy as np
import matplotlib.pyplot as plt
import RPi.GPIO as GPIO # Import the GPIO library.
import time # Import time library
GPIO.setup(12, GPIO.OUT) # Set GPIO pin 12 to output mode.
pwm = GPIO.PWM(12, 100)
cap = cv2.VideoCapture(0) #Webcam Capture
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
template = cv2.imread('gate.jpg',0)
w, h = template.shape[::-1]
res = cv2.matchTemplate(gray,template,cv2.TM_CCOEFF_NORMED)
threshold = 0.8
loc = np.where(res>threshold)
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
top_left = min_loc
bottom_right = (top_left+w,top_left+h)