V4l2裁剪,缩放,组合功能资料

概述

涉及V4L2的VIDIOC_G_SELECTION和VIDIOC_S_SELECTION的ioctl的使用。这里仅将做资料记录。

  • V4l2 ioctl官方文档
    https://01.org/linuxgraphics/gfx-docs/drm/media/uapi/v4l/user-func.html
  • 该ioctl涉及到的参数为struct v4l2_selection,该结构体可选参数
    https://01.org/linuxgraphics/gfx-docs/drm/media/uapi/v4l/selections-common.html#v4l2-selections-common
  • 具体操作以及例子
    https://01.org/linuxgraphics/gfx-docs/drm/media/uapi/v4l/selection-api.html#selection-api

一个例子

数据源960480 --> 1280720

	struct v4l2_selection crop;	
	crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
	crop.target = V4L2_SEL_TGT_CROP_BOUNDS;//给出了可采样区域的左上角坐标范围、宽度和高度。
	ioctl(fd, VIDIOC_G_SELECTION, &crop);
	
	crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
	crop.target = V4L2_SEL_TGT_CROP;    //获取到裁剪区域
	crop.r.left = 0;
	crop.r.top = 0;
	crop.r.width = 960;   //源大小
	crop.r.height = 480;
	ioctl(fd, VIDIOC_S_SELECTION, &crop);

	crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
	crop.target = V4L2_SEL_TGT_COMPOSE;   //合成
	crop.r.left = 0;
	crop.r.top = 0;
	crop.r.width = 1280;   //目的大小
	crop.r.height = 720;
	ioctl(fd, VIDIOC_S_SELECTION, &crop);
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值