If you 'sudo apt-get install v4l-utils' you can use this to capture a frame from the camera:
v4l2-ctl --stream-mmap --stream-to=foo.raw --stream-count=1
foo.raw is 10077696 bytes, 2 bytes for each of the 2592x1944 pixels. If you want to write your own code to grab frames like this, this capture example gets you most of the way there, but you need to request the V4L2_PIX_FMT_SRGGB10 (raw bayer) format instead of the default. So change init_device to be like this:
static void init_device(void)
{
struct v4l2_format format = {0};
format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
format.fmt.pix.width = 2592;
format.fmt.pix.height = 1944;
format.fmt.pix.pixelformat = V4L2_PIX_FMT_SRGGB10;
format.fmt.pix.field = V4L2_FIELD_NONE;
int retval = xioctl(fd, VIDIOC_S_FMT, &format);
if (retval == -1) { perror("Setting format\n"); exit(3); }
if (io != IO_METHOD_MMAP) {
printf("Sorry, Jetson TX1 v4l2 only supports mmap\n");
exit(4);
}
init_mmap();
}
1 comment:
Post a Comment