All of lore.kernel.org
 help / color / mirror / Atom feed
From: Darren Longhorn <darren.longhorn@redembedded.com>
To: video4linux-list@redhat.com
Subject: Re: Saving YUVY image from V4L2 buffer to file
Date: Wed, 03 Feb 2010 18:38:19 +0000	[thread overview]
Message-ID: <4B69C29B.4010405@redembedded.com> (raw)
In-Reply-To: <SNT123-W319B38F63C77A4CFB0FD99EE560@phx.gbl>

Owen O' Hehir wrote:
> Hello All,
> 
> I'm trying to save a captured image from a USB camera to a file. The capture is based on V4L2 video capture example from the V4L2 API spec. http://v4l2spec.bytesex.org/spec/a16706.htm
> 
> The V4L2 set pointers (via mmap) to to the USB image (in YUV 4:2:2 (YUYV)) and as far as I can see the simplest way to save the image in a recognised format is in RGB format, specifically in PPM (Netpbm color image format).
> 
> As such I've expanded the process_image function:
> 
> 
> static void
> process_image                   (const void *           p)
> {
>     static int count = 0;
> 
>     static int r,g,b;
>     static int y1,y2,cb,cr;
> 
>     int pixel=0;
> 
>         FILE* fp = fopen("datadump", "w" );
>         // Write PNM header
>         fprintf( fp, "P6\n" );
>         fprintf( fp, "# YUV422 frame -> RGB \n" );
>         fprintf( fp, "%d %d\n", userfmt.fmt.pix.width, userfmt.fmt.pix.height );
> 
>         fprintf( fp, "255\n" );
> 
>         while(pixel < (userfmt.fmt.pix.width * userfmt.fmt.pix.height)){
> 
>         y1 = *(p+pixel);

Are you sure that's your real code? I don't think you should dereference
a void pointer like that.

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

  parent reply	other threads:[~2010-02-03 18:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03 17:40 Saving YUVY image from V4L2 buffer to file Owen O' Hehir
2010-02-03 17:54 ` Devin Heitmueller
2010-02-03 18:06   ` Owen O' Hehir
2010-02-03 18:18     ` Devin Heitmueller
2010-02-06 20:48       ` Saving YUVY image from V4L2 buffer to file - SOLVED Owen O' Hehir
2010-02-03 18:57     ` Saving YUVY image from V4L2 buffer to file Charlie X. Liu
2010-02-03 19:18       ` Devin Heitmueller
2010-02-03 20:01         ` Charlie X. Liu
2010-02-03 20:12           ` Devin Heitmueller
2010-02-03 18:38 ` Darren Longhorn [this message]
2010-02-04  2:23   ` Andy Walls
2010-02-04 15:58     ` Darren Longhorn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B69C29B.4010405@redembedded.com \
    --to=darren.longhorn@redembedded.com \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.