diy:projets:chromakey
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| diy:projets:chromakey [2018/06/25 09:05] – [Sources du projet] sdurand | diy:projets:chromakey [2018/07/02 09:35] (Version actuelle) – [Sources du projet] sdurand | ||
|---|---|---|---|
| Ligne 447: | Ligne 447: | ||
| === " | === " | ||
| + | <code C++> | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | // WIDTH, HEIGHT and NUMBER_OF_FRAMES should always be set to the same value as in the transmitter | ||
| + | #define WIDTH 1280 | ||
| + | #define HEIGHT 720 | ||
| + | // Maximum size of the received frame | ||
| + | // In theory, if jpeg doesn' | ||
| + | // I'm not sure it can ever happen, so, as this program should not be used for critical stuff (it really should not), I'm just gonna assume it won't happen | ||
| + | #define FRAME_SIZE WIDTH*HEIGHT*3 | ||
| + | #define NUMBER_OF_FRAMES 150 | ||
| + | |||
| + | #define ALL_GOOD 0 | ||
| + | |||
| + | |||
| + | |||
| + | int main(int argc, char **argv) { | ||
| + | // Actual size of the received frame | ||
| + | unsigned int size; | ||
| + | uchar buffer[FRAME_SIZE]; | ||
| + | cv::Mat frame; | ||
| + | |||
| + | for(int frame_count = 0; frame_count < NUMBER_OF_FRAMES; | ||
| + | // Reading the encoded image from stdin | ||
| + | // unsigned int and uchar size are the same on ARM and 64 bits regular computer | ||
| + | fread(& | ||
| + | fread(buffer, | ||
| + | |||
| + | std:: | ||
| + | |||
| + | // Decoding the received frame | ||
| + | frame = cv:: | ||
| + | |||
| + | // Displaying the received frame | ||
| + | cv:: | ||
| + | |||
| + | // This wait is mandatory for the image to actually display | ||
| + | cv:: | ||
| + | } | ||
| + | |||
| + | return ALL_GOOD; | ||
| + | } | ||
| + | </ | ||
| ---- | ---- | ||
| - | // | + | // |
diy/projets/chromakey.1529917550.txt.gz · Dernière modification : de sdurand
