Closed Scachi closed 3 years ago
Feature implemented and will be available to the next Gtuner IV release.
Here is the code I made to test this new feature, so you can have a better undestanding on how it works.
GPC Script:
uint32 counter;
main {
combo_run(GPCStringTest);
}
combo GPCStringTest {
wait(1000);
printf("GCMD:ComputerVision.PY:%d", counter++);
}
GCV Script (Python):
import cv2
import gtuner
class GCVWorker:
def __init__(self, width, height):
self.counter = "None"
def __del__(self):
del self.counter
def process(self, frame):
gpc_string = gtuner.gpc_string()
if gpc_string != None:
self.counter = gpc_string
frame = cv2.putText(frame, "COUNTER: "+self.counter, (20, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
return (frame, None)
perfect ! Thank you very much.
j2k gonna update cv python to 3.11? its like 95% faster then 3.8 it sure would be a great addition for cv
I think there is currently no easy way to send data from the .gpc to the .py script. One can utilize unused GPC Identifiers to do so, using set_val and reading those values back from the .py but its getting more complicated when one want to send 10 different values or more. (like havign to use a combo to set values and let the .py read them)
As an example.. you can an Interactive Configuration on the .gpc script where the user can set some values. Knowing those pmem values in the .py script may be required for easily handling the data and do the correct thing.
Is it possible to have some printf("COMMAND") one can use from the .gpc side and have access to the output panel or somehow pass that data in that command to the CV/.py script so we can parse that string/data in python ?
Any other idea to easily be able to pass data from the .gpc to .py without wasting too much bytecode space in a .gpc script file for this communication ?