A simpel way to get results from hailo in a c++ program.

I am working on a small program, to give my dog “goodies” if it is doing what it is told :slight_smile:
I don,t need the frame, only the label and frame count.
1 make a named pipe in the hailo/hailo-rpi5-examples directory
mkfifo hailo
then copy detection.py to dog.py
in dog.py insert import sys
and after the print statement

print(string_to_print)
sys.stdout.flush()

python3 basic_pipelines/dog.py --hef-path resources/madsens.hef --input rpi --labels-json resources/madsen.json --input madsen4.mp4 >> hailo

hailo sends the output to the hailo pipe.

this simple code read the pipe and show on screen

type or paste code here

#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<unistd.h>
#include<fcntl.h>
#include<sys/stat.h>
#include <iostream>

int main() {
 
    int desc = open("hailo", O_RDONLY);
    char c[1];
    while(1) {
        read(desc, c, sizeof(c));
        std::cout << c;
    }
         
    return 0;
}

It have to be started in the same dir as the pipe is create.
Now it is simple to use hailo string data “to do something”
It is NOT necessary to be in the virtual inv to use the pipe data.