![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
OpenCV
文章平均质量分 87
OpenCV学习笔记
赵_|大人
这个作者很懒,什么都没留下…
展开
-
copyTo(dst,mask)与clone()
Mat类Mat是一个类,由两个数据部分组成:矩阵头(包含矩阵尺寸、存储方法、存储地址信息)和一个指向存储所有像素值的矩阵(根据所选存储方法的不同,矩阵可以是不同的维度)的指针;所以应该尽量避免大图像的复制;为了解决这个问题,OpenCV引用计数机制。其思路是让每一Mat对象有自己的信息头,但共享同一个矩阵。这通过让矩阵指针指向同一地址而实现。而拷贝构造函数只复制信息头和矩阵指针,而不是复制矩阵;例如:Mat A ,B ,C;A=imread("1.jpg");Mat B(A);C=A;以上原创 2020-06-04 19:23:17 · 360 阅读 · 0 评论 -
rect类详解
rect类原型template<typename _Tp> class Rect_{public: typedef _Tp value_type; //! default constructor Rect_(); Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height); Rect_(const Rect_& r); Rect_(Rect_&& r) CV_NOEXCEPT;原创 2020-06-03 17:14:23 · 2667 阅读 · 0 评论 -
Opencv function
randu()生成单个均匀分布的随机数或随机数数组。/** @brief Generates a single uniformly-distributed random number or an array of random numbers.Non-template variant of the function fills the matrix dst with uniformly-distributedrandom numbers from the specified range:\f[\t原创 2020-06-03 15:11:07 · 249 阅读 · 0 评论 -
Mat对象的不同创建方式
#include <iostream>#include <opencv2/highgui/highgui.hpp>#include<opencv2/opencv.hpp>using namespace std;using namespace cv;int main(void){ /*最常用的方法是直接使用Mat()构造函数,这种方法简单明了:对于二维多通道 图像,首先要定义其尺寸,即行数与列数。然后需要定义存储元素的数据类型以及 每个矩阵点的通道数*/原创 2020-06-03 14:49:40 · 173 阅读 · 0 评论 -
Scalar类-颜色类
scalar-颜色类函数原型如下:template<typename _Tp> class Scalar_ : public Vec<_Tp, 4>{public: //! default constructor Scalar_(); Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);//最常用; Scalar_(_Tp v0); Scalar_(const Scalar_& s);原创 2020-06-02 23:08:50 · 2450 阅读 · 0 评论 -
RNG类(Random number generator)
RNG类:Random number generatorRandom number generator. It encapsulates the state (currently, a 64-bitinteger) and has methods to return scalar random values and to fillarrays with random values. Currently it supports uniform and Gaussian(normal) distrib原创 2020-06-02 21:24:20 · 1702 阅读 · 0 评论 -
OpenCV中CV_8UC3等类型含义
原型#define CV_USRTYPE1 (void)"CV_USRTYPE1 support has been dropped in OpenCV 4.0"#define CV_CN_MAX 512#define CV_CN_SHIFT 3#define CV_DEPTH_MAX (1 << CV_CN_SHIFT)#define CV_8U 0#define CV_8S 1#define CV_16U 2#define CV_16S 3#de原创 2020-06-02 15:46:54 · 2809 阅读 · 0 评论 -
createTrackbar()创建轨迹条
函数原型如下:[__Qt Backend Only__] winname can be empty if the trackbar should be attached to thecontrol panel.Clicking the label of each trackbar enables editing the trackbar values manually.@param trackbarname Name of the created trackbar.@param winnam原创 2020-06-02 09:43:48 · 482 阅读 · 0 评论 -
addWeighted()计算数组的加权和(融合)
The function addWeighted calculates the weighted sum of two arrays as follows:\f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} )\f]where I is a multi-dimensional index of arr原创 2020-06-01 18:20:16 · 733 阅读 · 0 评论 -
rectangle()函数与rect类详解
rectangle()函数rectangle()函数:在给定的图片上画出一个矩形框;有两个定义:定义1:@param img Image.@param pt1 Vertex of the rectangle.矩形的顶点@param pt2 Vertex of the rectangle opposite to pt1 .与p1相反的矩形的顶点@param color Rectangle color or brightness (grayscale image).@param thicknes原创 2020-06-01 16:19:48 · 4150 阅读 · 0 评论 -
Opencv中rectangle函数与Rect函数的用法
rectangle函数是用来绘制一个矩形框的,通常用在图片的标记上。1.rectangle(img2, Point(j,i), Point(j + img4.cols, i + img4.rows), Scalar(255, 255, 0), 2, 8);img2:被处理的图片Point(j,i)代表矩形左上点的坐标Point(j + cols, i + rows)代表矩形右下点的坐标【矩形的大小(cols,rows】scalar:颜色2代表线条宽度8是线型,默认取8Rect().原创 2020-06-01 15:14:59 · 22213 阅读 · 5 评论 -
OpenCV示例程序人脸检测程序运行出错解决方法
人脸检测示例程序一般在“…\opencv\sources\samples\cpp\tutorial_code\objectDetection”文件夹下;如果运行报错,可以通过以下方法解决;首先要将下面文件夹中的“haarcascade_eye_tree_eyeglasses.xml”和“haarcascade_frontalface_alt.xml”复制和源文件在一个文件夹中才能运行;…\opencv\sources\data\haarcascades如果第一步之后仍然无法运行则原创 2020-05-29 22:05:25 · 1670 阅读 · 1 评论 -
OpenCV_Problem_in_install(version_3.4 and system version ubuntu 16.04)
errorthe error line is:In file included from /home/zero/Program/opencv-3.4.0/modules/stitching/include/opencv2/stitching.hpp:49:0, from /home/zero/Program/opencv-3.4.0/modules/stitching/src/precomp.hpp:59, from /home/zer原创 2020-09-05 21:13:29 · 123 阅读 · 0 评论 -
OpenCV全屏显示
setWindowProperty()The function setWindowProperty enables changing properties of a window.@param winname Name of the window.@param prop_id Window property to edit. The supported operation flags are: (cv::WindowPropertyFlags)@param prop_value New value原创 2020-08-15 15:40:32 · 1481 阅读 · 0 评论 -
OpenCV+PlaySound()
一、PlaySound()介绍:PlaySound()是Windows用于播放音乐的API函数(方法)。在vs2010以上版本需要加入#pragma comment(lib, “winmm.lib”)才能使用PlaySound。BOOL PlaySound(LPCSTR pszSound, HMODULE hmod,DWORD fdwSound)。/*@pszSound:pszSound是指定了要播放声音的字符串,该参数可以是WAVE文件的名字,或是WAV资源的名字,或是内存中声音数据的指针,原创 2020-08-10 17:39:33 · 501 阅读 · 0 评论 -
OpenCV_VideoCapture
1.Video Capture property宽度:cap.get(CV_CAP_PROP_FRAME_WIDTH) 高度:cap.get(CV_CAP_PROP_FRAME_HEIGHT)总帧数: cap.get(CV_CAP_PROP_FRAME_COUNT)帧率(fps):cap.get(CV_CAP_PROP_FPS) enum VideoCaptureProperties { CAP_PROP_POS_MSEC =0, //!< Curr原创 2020-08-10 14:57:56 · 458 阅读 · 0 评论 -
解决OpenCV在Cmake时,因网络问题无法下载部分所需文件
在进行Cmake配置OpenCV时出现以下问题的解决办法:IPPICV:Download:ippicv_2020_Win_ia32_20191018_general.zip下载失败进入opencv4.3.0\sources\3rdparty\ippicv目录,将 ippicv.cmake 第42行的 "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_COMMIT}/ippicv/"修改为:"https://raw原创 2020-06-28 21:18:07 · 13569 阅读 · 18 评论 -
creat RIO by rect() and range()
Rect()cv::Rect 表示一个矩形区域,常用的构造函数如下:Rect_ (_Tp _x, _Tp _y, _Tp _width, _Tp _height)前两个参数表示的是所选区域的左上角的坐标值x和y, 后两个参数表示所选区域的宽和高。Mat dstImage=scrImage(0,0,scrImage.rows/2,scrImage.cols/2);Range()1.Range是OpenCV中新加入的一个类,该类有两个关键的变量start和end;2.Range对象可以用来表示矩原创 2020-06-22 10:34:14 · 179 阅读 · 0 评论 -
adaptiveThreshold()讲解
概念:adaptiveThreshold(),即对矩阵采用自适应阈值操作;函数原型如下:The function can process the image in-place.@param src Source 8-bit single-channel image.@param dst Destination image of the same size and the same type as src.@param maxValue Non-zero value assigned to th原创 2020-06-15 16:57:03 · 2991 阅读 · 0 评论 -
dft()离散傅里叶变换(Discrete Fourier Transform)
离散傅里叶概念离散傅里叶变换,是指傅里叶变换在时域上和频域上都呈离散的形式,将时域信号的采样变换为在离散时间傅里叶变换频域的采样。简单的说,对一张图像使用傅里叶变换就是将它们分解成正弦和余弦两部分,也就是将图像从空间域(spatial domain)转换到频域(frequency domain)。F(x,y)=∑i=0N−1∑j=0N−1f(i,j)e−i2π(kiN+ljN)\displaystyle\sum_{i=0}^{N-1}\sum_{j=0}^{N-1}f(i,j)e^{-i2\pi(\fr原创 2020-06-08 17:45:29 · 1222 阅读 · 0 评论