Skip to content

Commit

Permalink
exported default args into utils
Browse files Browse the repository at this point in the history
  • Loading branch information
cansik committed Dec 8, 2020
1 parent aa0a895 commit 73dd7ae
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
venv
.idea
.idea
*.pyc
16 changes: 3 additions & 13 deletions pose.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import argparse
from typing import List, Tuple

import cv2
import mediapipe as mp
from mediapipe.framework.formats import landmark_pb2
from pythonosc import udp_client
from pythonosc.osc_message_builder import OscMessageBuilder

from utils import add_default_args

POSE_ADDRESS = "/mediapipe/pose"


Expand All @@ -31,18 +32,7 @@ def send_pose(client: udp_client,
def main():
# read arguments
parser = argparse.ArgumentParser()
parser.add_argument("--device", type=int, default=0,
help="The id of the capture device (camera)")

parser.add_argument("-mdc", "--min-detection-confidence", type=float, default=0.5,
help="Minimum confidence value ([0.0, 1.0]) for the detection to be considered successful.")
parser.add_argument("-mtc", "--min-tracking-confidence", type=float, default=0.5,
help=" Minimum confidence value ([0.0, 1.0]) to be considered tracked successfully.")

parser.add_argument("--ip", default="127.0.0.1",
help="The ip of the OSC server")
parser.add_argument("--port", type=int, default=7500,
help="The port the OSC server is listening on")
add_default_args(parser)
args = parser.parse_args()

# create osc client
Expand Down
16 changes: 16 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from argparse import ArgumentParser


def add_default_args(parser: ArgumentParser):
parser.add_argument("--device", type=int, default=0,
help="The id of the capture device (camera)")

parser.add_argument("-mdc", "--min-detection-confidence", type=float, default=0.5,
help="Minimum confidence value ([0.0, 1.0]) for the detection to be considered successful.")
parser.add_argument("-mtc", "--min-tracking-confidence", type=float, default=0.5,
help=" Minimum confidence value ([0.0, 1.0]) to be considered tracked successfully.")

parser.add_argument("--ip", default="127.0.0.1",
help="The ip of the OSC server")
parser.add_argument("--port", type=int, default=7500,
help="The port the OSC server is listening on")

0 comments on commit 73dd7ae

Please sign in to comment.