资源简介
友善之臂4412通过USB摄像头采集YUYV422格式图像,转码成RGB显示在800*480分辨率触摸屏上

代码片段和文件信息
#include
#include
#include
#include
#include /* getopt_long() */
#include /* low-level i/o */
#include
#include
#include
#include
#include
#include
#include
#include /* for videodev2.h */
#include
#include “camera.h“
#include “videodev2_samsung.h“
void Camera::DecodeYUV420SP(unsigned int* rgbBuf unsigned char* yuv420sp int width int height) {
int frameSize = width * height;
int i = 0 y = 0;
int uvp = 0 u = 0 v = 0;
int y1192 = 0 r = 0 g = 0 b = 0;
unsigned int xrgb8888;
int xrgb8888Index = 0;
for (int j = 0 yp = 0; j < height; j++) {
uvp = frameSize + (j >> 1) * width;
u = 0;
v = 0;
for (i = 0; i < width; i++ yp++) {
y = (0xff & ((int) yuv420sp[yp])) - 16;
if (y < 0) y = 0;
if ((i & 1) == 0) {
v = (0xff & yuv420sp[uvp++]) - 128;
u = (0xff & yuv420sp[uvp++]) - 128;
}
y1192 = 1192 * y;
r = (y1192 + 1634 * u);
g = (y1192 - 833 * u - 400 * v);
b = (y1192 + 2066 * v);
if (r < 0) r = 0; else if (r > 262143) r = 262143;
if (g < 0) g = 0; else if (g > 262143) g = 262143;
if (b < 0) b = 0; else if (b > 262143) b = 262143;
r = (unsigned char)(r >> 10);
g = (unsigned char)(g >> 10);
b = (unsigned char)(b >> 10);
xrgb8888 = (unsigned int)((r << 16) | (g << 8) | b);
rgbBuf[xrgb8888Index++] = xrgb8888;
}
}
}
//YUYV(yuv422)转RGB
void Camera:: video_yuyv_to_rgb24(unsigned char *yuv unsigned char *rgb unsigned int width unsigned int height)
{
unsigned int in out;
int y0 u y1 v;
unsigned int pixel24;
unsigned char *pixel = (unsigned char *)&pixel24;
unsigned int size = width*height*2;
for (in = 0 out = 0; in < size; in += 4 out += 8)
{
y0 = yuv[in+0];
u = yuv[in+1];
y1 = yuv[in+2];
v = yuv[in+3];
sign3 = true;
pixel24 = yuvtorgb(y0 u v);
rgb[out+0] = pixel[0]; //for QT
rgb[out+1] = pixel[1];
rgb[out+2] = pixel[2];
//rgb[out+0] = pixel[2]; //for iplimage
//rgb[out+1] = pixel[1];
//rgb[out+2] = pixel[0];
//sign3 = true;
pixel24 = yuvtorgb(y1 u v);
rgb[out+4] = pixel[0];
rgb[out+5] = pixel[1];
rgb[out+6] = pixel[2];
//rgb[out+3] = pixel[2];
//rgb[out+4] = pixel[1];
//rgb[out+5] = pixel[0];
}
//return 0;
}
int Camera:: yuvtorgb(int y int u int v)
{
unsigned int pixel24 = 0;
unsigned char *pixel = (unsigned char *)&pixel24;
int r g b;
static long int ruv guv buv;
if (sign3)
{
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-10-24 12:53 Camera\
文件 12982 2017-07-12 17:40 Camera\Camera.cpp
文件 1535 2017-07-12 17:40 Camera\camera.h
文件 3152 2017-07-11 21:54 Camera\Fb.cpp
文件 756 2017-07-11 21:54 Camera\Fb.h
文件 1085 2017-07-12 12:46 Camera\main.cpp
文件 574 2017-07-11 21:54 Camera\Makefile
文件 21041 2017-07-11 21:54 Camera\videodev2_samsung.h
- 上一篇:用ARM做的电子琴ARM
- 下一篇:管家婆项目文档讲义含源代码
相关资源
- FS4412 各模块驱动代码
- arm-cortex-a9技术参考手册
- tiny4412上移植linux4.4支持设备树的最终
- FS4412文件系统镜像文件
- FS4412 nfs镜像文件
- Cortex-A9 ARM 体系结构与接口技术
- fs4412 系统移植手册
- 三星Exynos4412使用手册 Cortex-A9使用手册
- Cotex-A9中文数据手册
- 嵌入式Linux系统开发完全手册_基于4
- exynos4412裸机系列教程源码
- iTop 4412原理图
- linux下关于Qt界面的摄像头v4l2操作源码
- tiny4412嵌入式系统搭建完整教程
- Exynos4412 数据手册 完整版
- FS4412系统移植uboot移植实验代码
- gcc-4.6.4.tar.xz fs4412交叉编译工具链
- u-boot-2017.11-iTop-4412
- 支持tiny4412-1506的uboot
- Tiny4412开发板所使用的linux3.5版本内核
- arm-none-linux-gnueabi-gcc-4.8.3
- uboot_tiny4412_0929.tar.gz
- ARM Cortex-A9==ARM培训资料
- Exynos4412完整用户手册共2858页
- 三星Exynos 4412完整用户手册和FS4412原理
- TIny4412 uboot
- itop4412 UBOOT源代码
- e98e7403d94412090cb2478041575722.zip
- Xilinx Zynq-7000 嵌入式系统设计与实现
- Xilinx Zynq-7000 嵌入式系统设计与实现
评论
共有 条评论