关于uvc camera 通过命令调整对比度,饱和度命令,fx3无法接收到命令问题

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

你好,我使用一个uvc工具验证发送设置camera 图像对比度,饱和度命令,但是CyU3PUsbRegisterSetupCallback(CyCx3AppUSBSetupCB, CyTrue)注册的回调函数不响应,函数头里加了日志也没有通过串口打印出来。此uvc工具直接测试usb camera摄像头是有效果的。我想咨询一下,fx3需要如何注册回调函数才会响应类似命令?

0 点赞
1 解答
16 回复数
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

请问一下,如果想增加Scale 缩放控制命令,请问有这样的参考例子吗?

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

没有一个命令叫scale,只有ZOOM (缩放)。处理方法是类似的:

Add the zoom control in the UVC desciptors. This is a camera terminal control. Also the standard UVC video control requests needs to be added in the firmware. The SET/GET request should contain the ISP register write/read.

目前没有现成的例子。

 

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

如果增加zoom缩放,是修改/* Input (Camera) Terminal Descriptor */这个描述符吗?

是修改:

0x00, 0x00, /* No optical zoom supported */
0x00, 0x00, /* No optical zoom supported */
0x00, 0x00, /* No optical zoom supported */这几个字段吗?

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

是的,您可能需要参考usb video class specification

 
0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

你好,我从相关文档里查到,

0x00, 0x00, /* No optical zoom supported */
0x00, 0x00, /* No optical zoom supported */
0x00, 0x00, /* No optical zoom supported */咨询一下这三个参数分别对应的是:

wObjectiveFocalLengthMin
wObjectiveFocalLengthMax
wOcularFocalLength

但是聚焦长度到底是一个什么概念,暂时不是太清楚,可以解释一下吗?是不是就是说的焦距1倍,2倍,3倍放大这个概念?

 

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

focal length翻译过来就是焦距的意思啊

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

其他参数uvc调整已经实现,就是现在zoom功能实现还有点问题,设置Zoom后图像静止。按照文档说明实现配置zoom功能:

对于任何小于 2592x1944 尺寸的图像,在保持图像宽高比与当前一致的情况下增加 X

offset 和 Y offset,即可得到数码变焦的效果。比如当输出图像尺寸为 1600x1200 像素时:

Digital Zoom 1x (1 倍)

DVPHO = 1600

DVPVO = 1200

X offset = 16

Y offset = 4

write_i2c(0x3212, 0x03);

// start group 3

write_i2c(0x3808, 0x06);

// DVPHO = 1600

write_i2c(0x3809, 0x40);

// DVP HO

write_i2c(0x380a, 0x04);

// DVPVO = 1200

write_i2c(0x380b, 0xb0);

// DVPVO

write_i2c(0x3810, 0x00);

// H offset = 16

write_i2c(0x3811, 0x10);

// H offset

write_i2c(0x3812, 0x00);

// V offset = 4

write_i2c(0x3813, 0x04);

// V offset

write_i2c(0x3212, 0x13);

// end group 3

write_i2c(0x3212, 0xa3);

// launch group 3

Digital Zoom 1.5x (1.5 倍)

DVPHO = 1600

DVPVO = 1200

input image width = 2592/1.5 = 1728 > 1600

input image height = 1944/1.5 = 1296 > 1200

X offset = 16 + (2592 – 1728)/2 = 448

Y offset = 4 + (1944 – 1296)/2 = 328

write_i2c(0x3212, 0x03);

// start group 3

write_i2c(0x3808, 0x06);

// DVPHO = 1600

write_i2c(0x3809, 0x40);

// DVP HO

write_i2c(0x380a, 0x04);

// DVPVO = 1200

write_i2c(0x380b, 0xb0);

// DVPVO

write_i2c(0x3810, 0x01);

// H offset = 448

write_i2c(0x3811, 0xc0);

// H offset

write_i2c(0x3812, 0x01);

// V offset = 328

write_i2c(0x3813, 0x48);

// V offset

write_i2c(0x3212, 0x13);

// end group 3

write_i2c(0x3212, 0xa3);

// launch group 3

按资料说明配置不同zoom大小。用几个测试软件都一写参数后图像就静止了。请问实现zoom功能参数后,camera还需要设置其他流程吗?

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

您这个命令执行完之后,是否有看过串口log中的frame的size是否发生了相应的变化?如果size是对的,那就是windows端接收的问题,如果size不对,那就是sensor传过来的s数据不对。

 
0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

咨询一下,现在对zoom缩放几倍的计算方式有点不太明白,资料上有一个计算公式:

Digital Zoom 1.5x (1.5 倍)

DVPHO = 1600

DVPVO = 1200

input image width = 2592/1.5 = 1728 > 1600

input image height = 1944/1.5 = 1296 > 1200

X offset = 16 + (2592 – 1728)/2 = 448

Y offset = 4 + (1944 – 1296)/2 = 328

假如当前摄像头的显示分别率为640*480,那么我要设置1x,1.5x,2.0x时,H offset, V offset的计算方式是怎样的?是不是这样:

{
//1x
//DVPHO = 640
//DVPVO = 480
//input image width = 640/1.0 = 640
//input image height = 480/1.0 =480
// H offset = 16
// V offset = 4
{0x3212,0x03}, // start group 3
{0x3808,0x02}, // DVPHO = 640
{0x3809,0x80}, // DVP HO
{0x380a,0x01}, // DVPVO = 480
{0x380b,0xe0}, // DVPVO

{0x3810,0x00}, // H offset = 16
{0x3811,0x10}, // H offset
{0x3812,0x00}, // V offset = 4
{0x3813,0x04}, // V offset

{0x3212,0x13}, // end group 3
{0x3212,0xa3} // launch group 3
},
{
//1.5x
//DVPHO = 640
//DVPVO = 480
//input image width = 640/1.5 = 426
//input image height = 480/1.5 =320
//X offset = 16 + (640 – 426)/2 = 16+107
//Y offset = 4 + (480 – 320)/2 = 4+80
{0x3212,0x03}, // start group 3
{0x3808,0x02}, // DVPHO = 640
{0x3809,0x80}, // DVP HO
{0x380a,0x01}, // DVPVO = 480
{0x380b,0xe0}, // DVPVO

{0x3810,0x00}, // H offset = 107+16=123
{0x3811,0x7b}, // H offset
{0x3812,0x00}, // V offset = 80+4=84
{0x3813,0x54}, // V offset

{0x3212,0x13}, // end group 3
{0x3212,0xa3} // launch group 3
},
{
//2.0x
//DVPHO = 640
//DVPVO = 480
//input image width = 640/2.0 = 320
//input image height = 480/2.0 = 240
//X offset = 123 + (640 – 320)/2 = 16+160
//Y offset = 84 + (480 – 240)/2 = 4+120
{0x3212,0x03}, // start group 3
{0x3808,0x02}, // DVPHO = 640
{0x3809,0x80}, // DVP HO
{0x380a,0x01}, // DVPVO = 480
{0x380b,0xe0}, // DVPVO

{0x3810,0x01}, // H offset = 123+160=283
{0x3811,0x1b}, // H offset
{0x3812,0x00}, // V offset = 84+120=204
{0x3813,0xcc}, // V offset
{0x3212,0x13}, // end group 3
{0x3212,0xa3} // launch group 3
},

这样配置后,1x,1.5x时有效果,但是2.0x时就没有效果了。请问一下我这样的计算方式是否正确?

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hi,

 

请问您可以提供下联系方式吗?

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

13538117986 刘

0 点赞

咨询一下,usb uvc的usb可以通过什么函数配置设置默认为usb2.0的速度?

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

CyU3PConnectState (CyTrue, CyFalse);

 
0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

咨询一下,你们例子里:

case CX3_USB_APP_GET_RES_REQ: /* Resolution = 1. */
LOG("CX3_USB_APP_GET_RES_REQ");
glUvcEp0Buffer[0] = 1;
CyU3PUsbSendEP0Data (2, (uint8_t *)glUvcEp0Buffer);
break;
case CX3_USB_APP_GET_INFO_REQ: /* Both GET and SET requests are supported, auto modes not supported */
LOG("CX3_USB_APP_GET_INFO_REQ");
glUvcEp0Buffer[0] = 3;
CyU3PUsbSendEP0Data (2, (uint8_t *)glUvcEp0Buffer);
break;

这里的case CX3_USB_APP_GET_RES_REQ: /* Resolution = 1. */代表时什么意思,1又代表什么意思?case CX3_USB_APP_GET_INFO_REQ 里的glUvcEp0Buffer[0] = 3;又是什么意思?这是你们调整亮度参考例子参数。用同一个测试程序(第三方的)测试其他usb  camera时的亮度,饱和度,色度,对比度时,界面非常自然不会卡顿。但是测试我们cx3 usb uvc时,同样的操作,界面会卡顿严重。

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

GET_RES_REQ = Get resolution request, 是bRequest 命令之一。 

YiZ_31_0-1615195984413.png

 

 

 

0 点赞