Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding in Object Tracking #11

Merged
merged 31 commits into from
Mar 17, 2021
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update detect.py
  • Loading branch information
luke-iqt committed Mar 3, 2021
commit be5967d7336d78457c2871f628683e6572b72d31
12 changes: 7 additions & 5 deletions object-tracker/opencv/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,18 @@ def detectCoralDevBoard():
GainX = 0.2
GainY = 0.2

def processCoordinates(x,y):
def motionControl(x,y):
targetCoordinates = [x,y]
targetCoordinates[0] = float(targetCoordinates[0])/(Resolution[0]/2.0)*Signage[0] # Convert X coordinate to be distance from frame center
targetCoordinates[1] = float(targetCoordinates[1])/(Resolution[1]/2.0)*Signage[1] # Convert Y coordinate to be distance from frame center
targetCoordinates[0] = (float(targetCoordinates[0]) - (Resolution[0]/2.0))*Signage[0] # X: Convert frame coordinate to center coordinate
targetCoordinates[1] = (float(targetCoordinates[1]) - (Resolution[1]/2.0))*Signage[1] # Y: Convert frame coordinate to center coordinate
targetCoordinates[0]*=GainX # Apply Control Gain in X direction
targetCoordinates[1]*=GainY # Apply Control Gain in Y direction
targetCoordinates[0] = int(targetCoordinates[0]*(Resolution[0]/2.0)) * Signage[0]
targetCoordinates[1] = int(targetCoordinates[1]*(Resolution[0]/2.0)) * Signage[1]

targetCoordinates[0] = (float(targetCoordinates[0]) + (Resolution[0]/2.0))*Signage[0] # X: Convert center coordinate to frame coordinate
targetCoordinates[1] = (float(targetCoordinates[1]) - (Resolution[1]/2.0))*Signage[1] # Y: Convert center coordinate to frame coordinate
return targetCoordinates


def main():
global mot_tracker
global mqtt_bridge
Expand Down