Skip to content

Instantly share code, notes, and snippets.

@maltoze
Created July 28, 2022 06:18
Show Gist options
  • Save maltoze/e19e0c6ede77e686d34981ad24ebed94 to your computer and use it in GitHub Desktop.
Save maltoze/e19e0c6ede77e686d34981ad24ebed94 to your computer and use it in GitHub Desktop.
import ctypes
import logging
import signal
import sys
def main():
lib = ctypes.cdll.LoadLibrary(
"./bazel-bin/mediapipe/examples/desktop/object_detection_dll/object_detection_cpu.dll"
)
def signal_handler(sig, frame):
lib.MPPRelease()
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
@ctypes.CFUNCTYPE(None, ctypes.c_int)
def callback(a):
print("Number of person: ", a)
lib.MPPSetNumPersonCallback(callback)
lib.MPPRunGraph()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment