From 0388e93ed9eea09c0f7ea889ebbc75231258f0b0 Mon Sep 17 00:00:00 2001 From: esimov Date: Wed, 9 Nov 2022 16:03:01 +0200 Subject: [PATCH] Fixed Windows error on blink detection demo --- examples/blinkdet/blinkdet.h | 3 +-- examples/blinkdet/blinkdet.py | 9 +-------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/examples/blinkdet/blinkdet.h b/examples/blinkdet/blinkdet.h index 5cafc58..4ffbc8a 100644 --- a/examples/blinkdet/blinkdet.h +++ b/examples/blinkdet/blinkdet.h @@ -68,8 +68,7 @@ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; extern "C" { #endif - -extern GoUintptr FindFaces(GoSlice p0); +extern __declspec(dllexport) GoUintptr FindFaces(GoSlice pixels); #ifdef __cplusplus } diff --git a/examples/blinkdet/blinkdet.py b/examples/blinkdet/blinkdet.py index d574b44..6f31e80 100644 --- a/examples/blinkdet/blinkdet.py +++ b/examples/blinkdet/blinkdet.py @@ -1,14 +1,11 @@ from ctypes import * -import subprocess import numpy as np import os import cv2 -import time os.system('go build -o blinkdet.so -buildmode=c-shared blinkdet.go') pigo = cdll.LoadLibrary('./blinkdet.so') -os.system('rm blinkdet.so') MAX_NDETS = 2024 ARRAY_DIM = 6 @@ -38,7 +35,7 @@ def process_frame(pixs): if data_pointer : buffarr = ((c_longlong * ARRAY_DIM) * MAX_NDETS).from_address(addressof(data_pointer.contents)) - res = np.ndarray(buffer=buffarr, dtype=c_longlong, shape=(MAX_NDETS, 5,)) + res = np.ndarray(buffer=buffarr, dtype=c_longlong, shape=(ARRAY_DIM, 5,)) # The first value of the buffer aray represents the buffer length. dets_len = res[0][0] @@ -54,10 +51,6 @@ cap = cv2.VideoCapture(0) cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) -# Changing the camera resolution introduce a short delay in the camera initialization. -# For this reason we should delay the object detection process with a few milliseconds. -time.sleep(0.4) - show_pupil = True show_eyes = False face_posy = 0