iplimage

OpenCV——肤色检测

允我心安 提交于 2019-12-30 03:00:03
一、RGB color space 检测代码如下: void SkinRGB(IplImage* src,IplImage* dst) { //RGB颜色空间 //均匀照明:R>95,G>40,B>20,R-B>15,R-G>15,R>B%R //侧向照明:R>200,G>210,B>170,R-B<=15,R>B,G>B int height = src->height, width = src->width, channel = src->nChannels, step = src->widthStep; int b = 0, g = 1, r = 2; cvZero(dst); unsigned char* p_src = (unsigned char*)src->imageData; unsigned char* p_dst = (unsigned char*)dst->imageData; for(int j = 0; j < height; j++){ for(int i = 0; i < width; i++){ if((p_src[j*step+i*channel+r] > 95 && p_src[j*step+i*channel+g] > 40 && p_src[j*step+i*channel+b] > 20 && (p_src[j*step+i*channel

opencv学习笔记[10]:IplImage数据结构

落爺英雄遲暮 提交于 2019-12-27 02:54:09
1.IplImage数据结构 typedef struct _IplImage { int nSize; /* sizeof(IplImage) */ int ID; /* version (=0)*/ int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */ int alphaChannel; /* Ignored by OpenCV */ int depth; /* Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S, IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported. */ char colorModel[4]; /* Ignored by OpenCV */ char channelSeq[4]; /* ditto */ int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels. cvCreateImage can only create interleaved images */ int origin; /* 0 - top-left

opencv常用数据结构之:IplImage

五迷三道 提交于 2019-12-27 02:49:17
typedef struct_IplImage { int nSize; //IplImage大小 int ID; //版本(=0) int nChannels; //大多数OPENCV函数支持1、2、3或4个通道 int alphaChannel; //被opencv忽略 int depth; //像素的位深度,主要有以下支持格式:IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16U,IPL_DEPTH_16S, IPL_DEPTH_32S,IPL_DEPTH_32F 和 IPL_DEPTH_64F */ char colorMode[4]; //被opencv忽略 char channelSeq[4]; //被opencv忽略 int dataOder; //0:交叉存取颜色通道,1:分开的颜色通道;只有cvCreateImage可以创建交叉存取图像*/ int origin; //图像原点位置:0表示顶-左结构,1表示底-左结构 int align; //图像排列方式(4 or 8),在opencv被忽略,使用widthStep代替 int width; //图像宽像素数 int height; //图像高像素数 struct_IplROI * roi; //图像感兴趣区域,当该值为空时,只对该区域进行处理 struct_IplImage

[opencv] 图像几何变换:旋转,缩放,斜切

不问归期 提交于 2019-12-26 15:13:36
几何变换 几何变换可以看成图像中物体(或像素)空间位置改变,或者说是像素的移动。 几何运算需要空间变换和灰度级差值两个步骤的算法,像素通过变换映射到新的坐标位置,新的位置可能是在几个像素之间,即不一定为整数坐标。这时就需要灰度级差值将映射的新坐标匹配到输出像素之间。最简单的插值方法是最近邻插值,就是令输出像素的灰度值等于映射最近的位置像素,该方法可能会产生锯齿。这种方法也叫零阶插值,相应比较复杂的还有一阶和高阶插值。 插值算法感觉只要了解就可以了,图像处理中比较需要理解的还是空间变换。 空间变换 空间变换对应矩阵的 仿射变换 。一个坐标通过函数变换的新的坐标位置: 所以在程序中我们可以使用一个2*3的数组结构来存储变换矩阵: 以最简单的平移变换为例,平移(b1,b2)坐标可以表示为: 因此,平移变换的变换矩阵及逆矩阵记为: 缩放变换:将图像横坐标放大(或缩小)sx倍,纵坐标放大(或缩小)sy倍,变换矩阵及逆矩阵为: 选择变换:图像绕原点逆时针旋转a角,其变换矩阵及逆矩阵(顺时针选择)为: OpenCV中的图像变换函数 基本的放射变换函数: void cvWarpAffine( const CvArr* src,//输入图像 CvArr* dst, //输出图像 const CvMat* map_matrix, //2*3的变换矩阵 int flags=CV_INTER_LINEAR

Copying a portion of an IplImage into another Iplimage (that is of same size is the source)

佐手、 提交于 2019-12-24 11:47:04
问题 I have a set of mask images that I need to use everytime I recognise a previously-known scene on my camera. All the mask images are in IplImage format. There will be instances where, for example, the camera has panned to a slightly different but nearby location. this means that if I do a template matching somewhere in the middle of the current scene, I will be able to recognise the scene with some amount of shift of the template in this scene. All I need to do is use those shifts to adjust

ISampleGrabber::BufferCB to IplImage; display in OpenCV shows garbled image - C++

北城余情 提交于 2019-12-24 11:36:30
问题 I'm using DirectShow to access a video stream, and then using the SampleGrabber filter and interface to get samples from each frame for further image processing. I'm using a callback, so it gets called after each new frame. I've basically just worked from the PlayCap sample application and added a sample filter to the graph. The problem I'm having is that I'm trying to display the grabbed samples on a different OpenCV window. However, when I try to cast the information in the buffer to an

Compressing IplImage to JPEG using libjpeg in OpenCV

醉酒当歌 提交于 2019-12-22 01:07:06
问题 So I have this problem. I have an IplImage that i want to compress to JPEG and do something with it. I use libjpeg8b.The code exit when it goes the function of jpeg_start_compress() with an error of "Bogus input colorspace" .Here are my code. #include "highgui.h" #include <stdio.h> #include "jpeglib.h" #include "cv.h" #include <iostream> #include <fstream> using namespace std; using namespace cv; #pragma comment(lib, "jpeglib.lib") bool ipl2jpeg(IplImage *frame, unsigned char **outbuffer,

Fastest method to convert IplImage IPL_DEPTH_32S to QImage Format_RGB32

六眼飞鱼酱① 提交于 2019-12-20 06:49:14
问题 What is the fastest method to convert IplImage IPL_DEPTH_32S to QImage Format_RGB32? I need to catch pictures from cam and show it on form with frequency 30 frames in second. I tried to use QImage constructor: QImage qImage((uchar *) image->imageData, image->width, image->height, QImage::Format_RGB32); but image was corrupted after this. So, how can I do this fast (I think putting pixel by pixel into QImage is not a good decision)? 回答1: Before I start, OpenCV uses the BGR format by default .

OpenCV IplImage data to float

若如初见. 提交于 2019-12-20 01:45:55
问题 Is there a way to convert IplImage pointer to float pointer? Basically converting the imagedata to float. Appreciate any help on this. 回答1: Use cvConvert(src,dst) where src is the source image and dst is the preallocated floating point image. E.g. dst = cvCreateImage(cvSize(src->width,src->height),IPL_DEPTH_32F,1); cvConvert(src,dst); 回答2: // Original image gets loaded as IPL_DEPTH_8U IplImage* colored = cvLoadImage("coins.jpg", CV_LOAD_IMAGE_UNCHANGED); if (!colored) { printf("cvLoadImage

虹软人脸识别3.0 - 图像数据结构介绍(C++)

时光怂恿深爱的人放手 提交于 2019-12-13 09:01:54
从虹软开放了2.0版本SDK以来,由于具有免费、离线使用的特点,我们公司在人脸识别门禁应用中使用了虹软SDK,识别效果还不错,因此比较关注虹软SDK的官方动态。近期上线了ArcFace 3.0 SDK版本,确实做了比较大的更新。上一篇主要介绍了关于Android平台算法的改进,本篇将介绍一下关于Windows平台算法的更新。 特征比对支持比对模型选择,有 生活照比对模型 和 人证比对模型 识别率、防***效果显著提升 特征值更新,升级后人脸库需重新注册 人脸检测同时支持全角度及单一角度 新增了一种图像数据传入方式 在V3.0版本接入过程中,发现使用新的图像数据结构还是具有一定难度的,本文将从以下几点对该图像数据结构及使用方式进行介绍 SDK接口变动 图像数据结构 步长的作用 OpenCV图像数据结构转换为虹软图像数据结构 一、SDK 接口变动 在接入ArcFace 3.0 SDK时,发现新增了ASFDetectFacesEx、ASFFaceFeatureExtractEx、ASFProcessEx、ASFProcessEx_IR一组接口,该组接口使用 LPASF_ImageData 结构体指针的方式传入图像数据,以人脸检测接口为例,具体接口比对如下: 原始接口: MRESULT ASFDetectFaces( MHandle hEngine, // [in] 引擎handle