-
usb_parrot_r16_tinav2.0_20161024_1758.7z下载
资源介绍
usb_parrot_r16_tinav2.0_20161024_1758.7z
UNICODE 全志R16平台TINAV2.0下的USB接口摄像头的配置
注意:由于没有配置CSI接口的摄像头(OV5640),所有USB接口的摄像头的设备节点为:/dev/video0。
1、在menuconfig中打开UVC
rootroot@rootroot-E400:~/wyb/parrot_r16_tinav2.0$ source build/envsetup.sh
including target/allwinner/tulip-d1/vendorsetup.sh
including target/allwinner/octopus-dev/vendorsetup.sh
including target/allwinner/astar-parrot/vendorsetup.sh
including target/allwinner/generic/vendorsetup.sh
including target/allwinner/astar-spk/vendorsetup.sh
including target/allwinner/astar-evb/vendorsetup.sh
rootroot@rootroot-E400:~/wyb/parrot_r16_tinav2.0$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. tulip_d1-tina
2. tulip_d1-dragonboard
3. octopus_dev-tina
4. octopus_dev-dragonboard
5. astar_parrot-tina
6. astar_parrot-dragonboard
7. astar_spk-tina
8. astar_spk-dragonboard
9. astar_evb-tina
Which would you like?5
============================================
PLATFORM_VERSION_CODENAME=Neptune
PLATFORM_VERSION=2.0.0
TARGET_PRODUCT=astar_parrot
TARGET_BUILD_VARIANT=tina
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=57513AA3
OUT_DIR=
============================================
rootroot@rootroot-E400:~/wyb/parrot_r16_tinav2.0$
rootroot@rootroot-E400:~/wyb/parrot_r16_tinav2.0$
rootroot@rootroot-E400:~/wyb/parrot_r16_tinav2.0$ make kernel_menuconfig
Device Drivers --->
<*> Multimedia support --->
[*] Video capture adapters --->
(选中)
[ ] V4L USB devices --->
--- V4L USB devices
(选中)
<*> USB Video Class (UVC)
[*] UVC input events device support
2、全志原声提供的cameratest有点错误。
Z:\home\wwt\parrot_r16_tinav2.0\package\allwinner\cameratest\src\common\hawkview.c
int fetch_sub_cmd(const char* buf,int buf_len,char** cmd,int* cmd_num,int lenght)
{
int i = 0,j = 0,n = 0;
while(buf[i] != '#'){ //the sub cmd end by '#'
while(buf[i] != 'x' && buf[i] != ':' && buf[i] != '#') {
if(i++ > buf_len) return 0;
*((char*)cmd + n*lenght + j++) = buf[i];
if(j > lenght) {
hv_err("sub cmd over long\n");
*cmd_num = n + 1;
return -1;
}
}
*((char*)cmd + n*lenght + j++) = '\0';
n++;
j = 0;
if(buf[i] != '#'){
i++;
}
if(n > *cmd_num){
hv_err("the max cmd num is %d\n",*cmd_num);
return -1;
}
}
*cmd_num = n;
return 0;
}
修改为:
int fetch_sub_cmd(const char* buf,int buf_len,char** cmd,int* cmd_num,int lenght)
{
int i = 0,j = 0,n = 0;
while(buf[i] != '#'){ //the sub cmd end by '#'
while(buf[i] != 'x' && buf[i] != ':' && buf[i] != '#') {
if((i+1) > buf_len) return 0;
*((char*)cmd + n*lenght + j++) = buf[i++];
if(j > lenght) {
hv_err("sub cmd over long\n");
*cmd_num = n + 1;
return -1;
}
}
*((char*)cmd + n*lenght + j++) = '\0';
n++;
j = 0;
if(buf[i] != '#'){
i++;
}
if(n > *cmd_num){
hv_err("the max cmd num is %d\n",*cmd_num);
return -1;
}
}
*cmd_num = n;
return 0;
}
3、根据USB摄像头的格式进行相应的修改:
修改cameratest/src/common/hawkview.c中的init_defualt_parameters()函数中
hv->capture.cap_fmt = V4L2_PIX_FMT_NV12; 将V4L2_PIX_FMT_NV12修改成你们使用的usb camera所支持的采集格式。
比如支持MJPEG格式,改成为
hv->capture.cap_fmt = V4L2_PIX_FMT_MJPEG;
如果是YUYV格式
hv->capture.cap_fmt = V4L2_PIX_FMT_YUYV;
如果是H264格式
hv->capture.cap_fmt = V4L2_PIX_FMT_H264;
一般usb camera就只有这些格式。
static int init_defualt_parameters(hawkview_handle* hv)
{
hv->capture.set_w = 1280;
hv->capture.set_h = 720;
hv->capture.video_no = 1;
hv->capture.subdev_id = 0;
hv->capture.cap_fps = 30;
// hv->capture.cap_fmt = V4L2_PIX_FMT_NV12;
hv->capture.cap_fmt = V4L2_PIX_FMT_YUYV;
hv->capture.sub_w = 640;
hv->capture.sub_h = 480;
hv->display.input_w = 640;
hv->display.input_h = 480;
return 0;
}
Z:\home\wwt\parrot_r16_tinav2.0\package\allwinner\cameratest\src\common\video_helper.c
int save_frame_to_file(void* str,void* start,int w,int h,int format,int is_one_frame)
{
FILE* fp;
int length;
// length = w*h*3>>1;
length = w*h*2;
if(is_one_frame)
fp = fopen(str,"wrb+"); //save one frame data
else
fp = fopen(str,"warb+"); //save more frames //TODO: test
if(!fp) {
hv_err("Open file error\n");
return -1;
}
if(fwrite(start,length,1,fp)){
fclose(fp);
return 0;
}
else {
hv_err("Write file fail\n");
fclose(fp);
return -1;
}
}
4、通过adb工具生成YUUV格式的YUV图片:
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\Administrator>adb shell
BusyBox v1.24.1 () built-in shell (ash)
_____ _ __ _
|_ _||_| ___ _ _ | | |_| ___ _ _ _ _
| | _ | || | | |__ | || || | ||_'_|
| | | || | || _ | |_____||_||_|_||___||_,_|
|_| |_||_|_||_|_| Tina is Based on OpenWrt!
----------------------------------------------
Tina Linux (Neptune, 57513AA3)
----------------------------------------------
root@TinaLinux:/# cd tmp
cd tmp
root@TinaLinux:/tmp#
root@TinaLinux:/tmp# echo "146:0:1:640x480#" > command
echo "146:0:1:640x480#" > command
root@TinaLinux:/tmp#
root@TinaLinux:/tmp# echo "149:test1013.yuv#" > command
echo "149:test1013.yuv#" > command
root@TinaLinux:/tmp#
root@TinaLinux:/tmp#
5、通过adb工具将生成YUUV格式的YUV图片拿到电脑上:
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\Administrator>adb pull /tmp/yuvtest1013.yuv c:\
6315 KB/s (614400 bytes in 0.095s)
C:\Users\Administrator>