[Linuxtrent] Re: [c++] cout trascura alcuni dati

  • From: Michele Bert <micbert75@xxxxxxxxx>
  • To: linuxtrent@xxxxxxxxxxxxx
  • Date: Thu, 23 Aug 2012 15:39:38 +0200

Il 23 agosto 2012 14:49, Matteo Perini <pepeyomat@xxxxxxxxx> ha scritto:
> Se salvo tutti i dati contenuti in "frame" in un file (ciao.pgm) non
> riscontro nessun problema.
>
>       imagefile=fopen("ciao.pgm", "wb");
>       fwrite(frame->image, 1, HEIGHT*WIDTH, imagefile);
>       fclose(imagefile);
>
> Se, al contrario, redirigo il frame sullo stdout (che poi leggo con python)
> con:
>
>       cout << frame->image;
>   o
>       cout <<frame;
> i pixel con valore 0 (nero) non vengono esportati (i numeri sono in hex).

Se vuoi riversare sullo standard output quello che più sopra salvi in
un file, puoi usare:

  fwrite(frame->image, 1, HEIGHT*WIDTH, stdout);

oppure

  cout.write(frame->image,HEIGHT*WIDTH);

Michele
--
Per iscriversi  (o disiscriversi), basta spedire un  messaggio con OGGETTO
"subscribe" (o "unsubscribe") a mailto:linuxtrent-request@xxxxxxxxxxxxx


Other related posts: