
Opencv
F l e
我们不生产代码,我们只是代码的搬运工
展开
-
相机姿态估计
目录一、相机姿态估计原理二、相机姿态估计原理实现一、相机姿态估计原理首先介绍一下什么是世界坐标系和相机坐标系——世界坐标系是自己定义的一个坐标系,这里我定义世界坐标系是X轴垂直屏幕指向人,Y轴水平向右,Z轴竖直向上。相机坐标系有统一的规定,如图所示,x轴平行于相机镜头水平向左,y轴平行于相机镜头向下,z轴垂直于镜头水平指向人。我们求相机在世界坐标系中的姿态的需求往往就是求一个相机坐标下的点在世界坐标系下的坐标,或者是一个世界坐标系下的点在相机坐标系的坐标。首先思考一下为什么能在一个确定的世界坐标系原创 2021-10-16 17:02:43 · 8500 阅读 · 9 评论 -
初识Opencv4.X----方框滤波
//方框滤波#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ //方框滤波,实际上与均值滤波一样,主要用在CV_32F的图像上 Mat img_gaussion = imread("gaussion.jpg"); Mat i原创 2021-09-16 15:46:32 · 176 阅读 · 0 评论 -
初识Opencv4.X----均值滤波
//均值滤波#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ //均值滤波 Mat img_gaussion = imread("gaussion.jpg"); Mat img_salt = imread("salt.jpg原创 2021-09-16 15:05:34 · 183 阅读 · 0 评论 -
初识Opencv4.X----为图像添加高斯噪声
//为图像添加高斯噪声#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ //噪声在图像中的分布概率密度满足高斯分布 Mat img = imread("person3.jpeg");//读取的是三通道图像 namedWin原创 2021-09-15 23:17:26 · 380 阅读 · 0 评论 -
初识Opencv4.X----为图像添加椒盐噪声
//为图像添加椒盐噪声#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;void add_salt(Mat & img);int main(){ //椒盐噪声,顾名思义就是在图像上撒上白色的盐和黑色的小黑椒 Mat img = imread原创 2021-09-15 21:00:56 · 274 阅读 · 0 评论 -
初识Opencv4.X----图像卷积
//图像卷积原理#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat src = (cv::Mat_<float>(5, 5) << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10原创 2021-09-15 20:23:45 · 140 阅读 · 0 评论 -
初识Opencv4.X----图像模板匹配
图像模板匹配知识://图像模板匹配#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat img = imread("person2.jpeg"); Mat temp = imread("person2_temp.jp原创 2021-09-14 22:57:39 · 274 阅读 · 0 评论 -
初识Opencv4.X----图像直方图匹配
直方图匹配的原理://图像直方图匹配#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;void drawHist(Mat &hist, int hist_w, int hist_h, int type, string name);int ma原创 2021-09-14 17:13:46 · 301 阅读 · 0 评论 -
初识Opencv4.X----图像直方图均衡
//图像直方图均衡#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;void drawHist(Mat &hist, int hist_w, int hist_h, int type, string name);int main(){ /*原创 2021-09-13 22:59:25 · 152 阅读 · 0 评论 -
初识Opencv4.X----图像直方图绘制
//图像直方图绘制#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat img = imread("person1.jpeg", IMREAD_GRAYSCALE); //统计0~255各个灰度值的像素个数 const原创 2021-09-13 21:15:05 · 201 阅读 · 0 评论 -
初识Opencv4.X----窗口交互操作
//窗口交互操作#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;void callback_width_brush(int,void*);void callback_mouse(int event, int x, int y, int flags, v原创 2021-09-12 20:50:48 · 231 阅读 · 0 评论 -
初识Opencv4.X----ROI截取
//ROI截取#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat img = Mat::zeros(Size(400, 400), CV_8UC1);//创建一个黑色背景,注意是Size(x,y),即(列,行) put原创 2021-09-12 15:59:15 · 315 阅读 · 0 评论 -
初识Opencv4.X----在图像上绘制形状
//在图像上绘制形状#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat img = Mat::zeros(Size(500, 500), CV_8UC1);//创建一个黑色背景,注意是Size(x,y),即(列,行)原创 2021-09-12 15:34:02 · 138 阅读 · 0 评论 -
初识Opencv4.X----图像透视变换
//图像图像透视变换#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ //图像的透视变换,需要3x3的旋转矩阵,总共9个参数,通过原图像和变换后的对应4个点就可以构造12个方程解出9个参数 Mat img = imread(原创 2021-09-11 12:03:31 · 165 阅读 · 0 评论 -
初识Opencv4.X----图像仿射变换
//图像仿射变换#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ //图像的仿射变换,需要2x3的旋转矩阵,总共6个参数,通过原图像和变换后的对应3个点就可以构造六个方程解出6个参数 Mat img = imread("pe原创 2021-09-11 11:45:21 · 204 阅读 · 0 评论 -
初识Opencv4.X----图像尺寸变换
//图像沿xy轴翻转#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat img = imread("person3.jpeg"); Mat dst; namedWindow("原图", WINDOW_NORMAL);原创 2021-09-10 21:17:27 · 138 阅读 · 0 评论 -
初识Opencv4.X----图像尺寸变换
//图像尺寸变换#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat dst; Mat img = imread("person3.jpeg"); Mat img_2 = imread("person1.jpeg");原创 2021-09-10 21:00:09 · 127 阅读 · 0 评论 -
初识Opencv4.X----图像拼接
//图像拼接#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat person1 = imread("person1.jpeg"); Mat person3 = imread("person3.jpeg"); //纵向原创 2021-09-10 20:20:50 · 284 阅读 · 0 评论 -
初识Opencv4.X----图像二值化
//图像二值化#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat img_color = imread("picture.jpeg"); Mat img_gray = imread("picture.jpeg", IM原创 2021-09-10 09:18:43 · 143 阅读 · 0 评论 -
初识Opencv4.X----官网学习网站
https://docs.opencv.org/4.4.0/index.html原创 2021-09-10 08:31:01 · 192 阅读 · 0 评论 -
初识Opencv4.X----像素的逻辑运算
//像素的逻辑运算#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat a = Mat(200, 200, CV_8UC1, Scalar(0)); Mat b = Mat(200, 200, CV_8UC1, Scal原创 2021-09-09 22:24:42 · 95 阅读 · 0 评论 -
两幅图像的像素比较
//两幅图像的像素比较#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ //system("color F0");//改变输出界面的颜色,白色 Mat word_img = cv::imread("word.jpeg");原创 2021-09-09 19:45:38 · 1955 阅读 · 0 评论 -
初识Opencv4.X----像素均值与标准差
//像素均值与标准差#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ system("color F0");//改变输出界面的颜色,白色 Mat img = cv::imread("picture.jpeg"); //求各原创 2021-09-09 14:46:23 · 290 阅读 · 0 评论 -
初识Opencv4.X----像素最值寻找
//像素最值寻找#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ system("color F0");//改变输出界面的颜色,白色 float a[10] = { 1,2,3,4,5,6,7,8,9,10 }; Mat原创 2021-09-09 13:14:55 · 156 阅读 · 0 评论 -
初识Opencv4.X----图像通道分离与合并
//图像通道分离与#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat img, imgs[3]; img = cv::imread("picture.jpeg"); //分离BGR通道并分别显示 cv::split原创 2021-09-08 11:30:29 · 121 阅读 · 0 评论 -
初识Opencv4.X----图像色彩空间转换
//图像色彩空间转换#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ Mat img,img32f,HSV,gray; img = cv::imread("picture.jpeg"); if (img.empty())原创 2021-09-07 20:12:46 · 115 阅读 · 0 评论 -
初识Opencv4.X----图像视频的读取与保存
1、图片的读取、显示和保存//图片的读取与保存#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ cv::Mat a; a = cv::imread("picture.jpeg", IMREAD_GRAYSCALE);//以原创 2021-09-07 15:45:16 · 262 阅读 · 0 评论 -
初识Opencv4.X----Mat类
1、Mat类//Mat的常见构造方法#include <stdio.h>#include <iostream>#include <string>#include <opencv2\opencv.hpp>using namespace std;using namespace cv;int main(){ //Mat类的构造 Mat a = cv::Mat::Mat();//a的属性由所赋的值决定 a = (cv::Mat_<int原创 2021-09-06 18:32:09 · 248 阅读 · 0 评论