资源简介
使用原始的RGB数据构造Opencv中的Mat对象。该资源使用Linux系统中的V4L2接口读取摄像头MJPEG图像数据,解码成RGB数据,再转换为Opencv中的Mat对象所使用的BGR格式

代码片段和文件信息
/****************************************************************************
# GspcaGui: Gspca/Spca5xx Grabber #
# Copyright (C) 2004 2005 2006 Michel Xhaard #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not write to the Free Software #
# Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA #
# #
****************************************************************************/
#include
#include
#include
#include “color.h“
static int *LutYr = NULL;
static int *LutYg = NULL;;
static int *LutYb = NULL;;
static int *LutVr = NULL;;
static int *LutVrY = NULL;;
static int *LutUb = NULL;;
static int *LutUbY = NULL;;
static int *LutRv = NULL;
static int *LutGu = NULL;
static int *LutGv = NULL;
static int *LutBu = NULL;
#if 0
#define RGB24_TO_Y(rgb) LutYr[(r)] + LutYg[(g)] + LutYb[(b)]
#define YR_TO_V(ry) LutVr[(r)] + LutVrY[(y)]
#define YB_TO_U(by) LutUb[(b)] + LutUbY[(y)]
#define R_FROMYV(yv) CLIP((y) + LutRv[(v)])
#define G_FROMYUV(yuv) CLIP((y) + LutGu[(u)] + LutGv[(v)])
#define B_FROMYU(yu) CLIP((y) + LutBu[(u)])
#endif
unsigned char
RGB24_TO_Y(unsigned char r unsigned char g unsigned char b)
{
return (LutYr[(r)] + LutYg[(g)] + LutYb[(b)]);
}
unsigned char
YR_TO_V(unsigned char r unsigned char y)
{
return (LutVr[(r)] + LutVrY[(y)]);
}
unsigned char
YB_TO_U(unsigned char b unsigned char y)
{
return (LutUb[(b)] + LutUbY[(y)]);
}
unsigned char
R_FROMYV(unsigned char y unsigned char v)
{
return CLIP((y) + LutRv[(v)]);
}
unsigned char
G_FROMYUV(unsigned char y unsigned char u unsigned char v)
{
return CLIP((y) + LutGu[(u)] + LutGv[(v)]);
}
unsigned char
B_FROMYU(unsigned char y unsigned char u)
{
return CLIP((y) + LutBu[(u)]);
}
void initLut(void)
{
int i;
#define Rcoef 299
#define Gcoef 587
#define Bcoef 114
#define Vrcoef 711 //656 //877
#define Ubcoef 560 //500 //493 564
#define CoefRv 1402
#define CoefGu 714 // 344
#define Co
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4012 2006-06-26 01:48 color.c
文件 416 2017-11-03 13:55 config.h
文件 6440 2017-11-28 20:08 convert.cpp
目录 0 2017-11-03 12:47 include\
文件 2978 2017-04-05 16:16 include\color.h
文件 424 2017-11-03 12:34 include\config.h
文件 535 2017-11-03 12:58 include\convert.h
文件 3250 2012-06-30 07:52 include\jinclude.h
文件 623 2017-03-31 20:07 include\pic_operation.h
文件 1068 2017-11-03 12:31 include\v4l2.h
文件 88883 2015-03-24 14:36 include\videodev2.h
文件 6516 2012-06-30 07:52 jdatasrc-tj.c
文件 1509 2017-11-28 20:02 main.cpp
文件 1000 2017-11-03 13:36 makefile
文件 900 2017-09-02 17:14 makefile.build
文件 8435 2017-11-03 13:26 v4l2.cpp
文件 956 2017-11-03 13:19 v4l2.h
- 上一篇:EDA电子琴设计
- 下一篇:stm32实时时钟,可以实现万年历
相关资源
- uboot到linux logo显示不间断 补丁
- UNIX/LINUX编程实践教程的源码
- Linux任务管理器
- linux应用层的华容道游戏源代码
- ubuntu9.10 可加载内核模块和字符设备驱
- MP3文件ID3v2ID3v2APEv2标签读取
- 操作系统实验——虚存管理实验
- 基于OpenCV的数字识别468815
- 使用opencv去掉二值化图像中黑色面积
- linux下的发包工具sendip
- 尚观培训linux许巍关于c 的笔记和讲义
- 尚观培训linux董亮老师关于数据结构的
- linux 线程池源码 c 版
- linux C 电梯程序练习
- linux下用多进程同步方法解决生产者
- Linux 操作系统实验(全)
- Linux From Scratch 中文手册
- linux 网络实验 ftp程序
- Linux命令大全离线版&在线版
- 操作系统共享内存实验
- dos 下运行Linux 命令--gnu_utils
- linux 0.12内核源代码
- linux简易shell C实现
- linux实验报告及心得体会
- 基于GTK的Linux环境下的简易任务管理器
- linux扫雷游戏代码
- CAN Linux驱动代码
- Linux系统教材
- opencv环境配置
- intel 82579LM 网卡驱动Linux系统版 v1.9.
评论
共有 条评论