VEYE IMAGING Forum
    • Categories
    • Tags
    • Recent
    • Popular
    • Users
    • WIKI
    • veye.cc
    • Register
    • Login

    关于V4l2设置分辨率失败

    Scheduled Pinned Locked Moved Jetson App Software
    4 Posts 2 Posters 2.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      robot
      last edited by

      我在使用V4l2获取图像时,使用了如下命令设置分辨率:
      struct v4l2_format fmt;
      fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
      ioctl(priv->fd,VIDIOC_G_FMT,&fmt);
      printf("width : %d,height : %d\n",fmt.fmt.pix.width,fmt.fmt.pix.height);
      printf("field : %d,bytesperline : %d\n",fmt.fmt.pix.field,fmt.fmt.pix.bytesperline);
      printf("sizeimage : %d,flags : %d\n",fmt.fmt.pix.sizeimage,fmt.fmt.pix.flags);
      printf("pixelformat : %d,quantization : %d\n",fmt.fmt.pix.pixelformat,fmt.fmt.pix.quantization);
      fmt.fmt.pix.width = USERWIDTH;
      fmt.fmt.pix.height = USERHEIGHT;
      ioctl(priv->fd,VIDIOC_S_FMT,&fmt);
      ioctl(priv->fd,VIDIOC_G_FMT,&fmt);
      printf("width : %d,height : %d\n",fmt.fmt.pix.width,fmt.fmt.pix.height);
      printf("field : %d,bytesperline : %d\n",fmt.fmt.pix.field,fmt.fmt.pix.bytesperline);
      printf("sizeimage : %d,flags : %d\n",fmt.fmt.pix.sizeimage,fmt.fmt.pix.flags);
      printf("pixelformat : %d,quantization : %d\n",fmt.fmt.pix.pixelformat,fmt.fmt.pix.quantization);

      结果生成的图像并不符合我的期望,如,我设置了640480的分辨率,fmt.fmt.pix.sizeimage应该为614400,但实际查询值为1228800,解码也是按1280480解才能正常显示,左边是我的图像但是右边是640*480的纯绿色色块,请问我需要设置什么值才能使他正常

      veye_xummV 1 Reply Last reply Reply Quote 0
      • veye_xummV Offline
        veye_xumm @robot
        last edited by veye_xumm

        @robot
        你好,请问你用的哪款摄像头模组,用的什么主控平台?

        Questions will be answered as soon as possible, please be patient.
        如果你使用中文,请直接用中文提问。
        May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

        R 1 Reply Last reply Reply Quote 0
        • R Offline
          robot @veye_xumm
          last edited by

          @veye_xumm
          cssc132相机,jeston nano平台
          我已找到有问题的参数为fmt.fmt.pix.bytesperline = USERWIDTH;
          问题已解决,谢谢了

          veye_xummV 1 Reply Last reply Reply Quote 0
          • veye_xummV Offline
            veye_xumm @robot
            last edited by

            @robot 点赞! 不客气~

            Questions will be answered as soon as possible, please be patient.
            如果你使用中文,请直接用中文提问。
            May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post