自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(41)
  • 收藏
  • 关注

原创 opencv构造Mat方法及其访问图像中的像素

1.构造Mat:#include <stdio.h>#include<sstream>#include <string> #include <iostream> #include <cstdlib>#include <opencv2/core/core.hpp>#include<opencv2/highgui/highgui.hpp>using namespace std;using namespace

2022-01-28 11:34:07 3164

原创 读取文件的四种方式

读取文件的四种方式:#include<iostream>#include<vector>#include <fstream>#include<algorithm>#include<string>#include<fstream>using namespace std;using namespace cv;void test02() { ifstream ifs; ifs.open("test01.txt", io

2021-12-11 18:45:19 929

原创 纯虚函数练习-饮品的制作和电脑组装

纯虚函数之饮品制作,三种方式实现函数的调用:代码实现:#include<iostream>#include<vector>#include <fstream>#include<algorithm>#include<string>using namespace std;using namespace cv;class AbstructMakedrink {public: virtual void Boil() = 0; vi

2021-12-11 10:41:10 360

原创 C++STL中map容器练习

案例描述:公司今天招聘了10个员工(ABCDEFGHIJ),10名员工进入公司之后,需要指派员工在那个部门工作员工信息有: 姓名 工资组成;部门分为:策划、美术、研发随机给10名员工分配部门和工资通过multimap进行信息的插入 key(部门编号) value(员工)分部门显示员工信息实现思路:创建10名员工,放到vector中遍历vector容器,取出每个员工,进行随机分组分组后,将员工部门编号作为key,具体员工作为value,放入到multimap容器中分部门显示员工信

2021-11-14 18:17:14 1405

原创 c++STL中vector、deque容器练习

评委打分的例子:要求:有五名选手ABCDE,10个评委打分,去掉最高分和最低分,求出每个选手的平均分。思路:1.创建Person类,定义那么,score,成员属性;创建五名选手存放到vector容器中;2.遍历vector容器,首先10个评委的打分存放到deque容器中,sort算法对分数排序,去掉最高最低分;3.deque容器遍历,进行剩余分数的累加,求平均;4.输出每个选手的姓名,成绩。#include<string>#include<vector>#inclu

2021-11-13 16:17:58 1235

原创 图像中关键点提取和pcl中点云的关键点提取

2.图像中关键点提取和pcl中点云的关键点提取2.1二维图像的Harris角点提取经典的Harris角点提取方法实质上就是对Moravec算子的改良和优化。从图像分析的角度来定义角点可以有以下两种定义:a.角点可以是两个边缘的的角点;b.角点是邻域内具有两个主方向的特征点;Harris角点检测原理主要参考:Harris角点提取和Harris角点检测原理Harris角点检测使用了图像窗口模板在待检测图像上在各个方向上平移,从而探测角点,图像窗口为:[u,v],产生灰度变化的自相关函数如下:其中

2021-06-25 16:32:56 1849

原创 相机标定和图像校正

一.相机标定和校正本文利用张正友标定方法进行单目相机的标定,使用的是棋盘格标定板,当然也可以使用圆图案的标定板甚至是二维码图案。张正友标定原理详见:相机标定之张正友标定法数学原理详解的博客,该推导都是假设不存在畸变参数的情况下成立的,在此补充几点:1)上式中H是单应矩阵,H是齐次矩阵所以H33=1,此时有8个独立未知元素。每一个标定板角点可以提供两个约束方程,因此,当一张图片上的标定板角点数量等于4时,即可求得该图片对应的矩阵 。当一张图片上的标定板角点数量大于4时,利用最小二乘法回归最佳的矩阵。此

2021-06-22 17:28:01 1889 2

转载 leetcode刷题

1.利用数组和返回指针的函数进行字符反转。#include <iostream> using namespace std;int main(void) { char str[]= "hello world!"; char *strReverse(char *str); cout << strReverse(str) << endl;// 输出 system("pause"); return 0;}//字符串反转char *strReverse(ch

2020-09-19 21:00:45 72

原创 opencv3编程入门毛星云(第三章3.18-3.21)

3.1.8输出图像:#include<opencv2/opencv.hpp>#include <stdio.h>#include<vector>using namespace cv;using namespace std;void createAlphaMat(Mat &mat){ for (int i = 0; i < mat.rows; ++i){ for (int j = 0; j < mat.cols; ++j){ V

2020-07-29 17:21:26 498

原创 opencv3编程入门(第十章10.1-10.3)

10.1Harris角点检测#include<opencv2/highgui/highgui.hpp>#include<opencv2/imgproc/imgproc.hpp>#include<opencv2/opencv.hpp>#include<iostream>using namespace cv;using namespace std;int main(){ Mat srcImage = imread("ying.jpg", 0);/

2020-07-27 11:11:06 135

原创 opencv3编程入门(第九章9.1-9.5)

9.2绘制H-S直方图#include<opencv2/highgui/highgui.hpp>#include<opencv2/imgproc/imgproc.hpp>#include<opencv2/opencv.hpp>#include<iostream>using namespace cv;using namespace std;int main(){ Mat srcImage, hsvImage; srcImage = imrea

2020-07-26 17:38:40 127

原创 opencv3编程入门(第八章8.3-8.6)

8.4图像的矩:#include<opencv2/highgui/highgui.hpp>#include<opencv2/imgproc/imgproc.hpp>#include<opencv2/opencv.hpp>#include<iostream>using namespace cv;using namespace std;#define WINDOW_NAME1 "原始图窗口"#define WINDOW_NAME2 "效果图窗口"

2020-07-24 15:57:17 104

原创 opencv3编程入门(第八章8.1-8.3)

8.13轮廓查找:#include<opencv2/highgui/highgui.hpp>#include<opencv2/imgproc/imgproc.hpp>#include<opencv2/opencv.hpp>using namespace cv;using namespace std;int main(int argc,char** argv){ Mat srcImage = imread("hehua.jpg", 0);//载入原图必须以二

2020-07-23 22:13:11 181

原创 opencv3编程入门(第七章7.3-7.5)

7.3重映射:#include<opencv2/highgui/highgui.hpp>#include<opencv2/imgproc/imgproc.hpp>using namespace cv;using namespace std;int main(){ Mat srcImage, dstImage; Mat map_x, map_y; srcImage = imread("tsg.jpg",1); if (!srcImage.data) { printf

2020-07-23 11:25:46 144

原创 opencv3编程入门(第七章7.1-7.2)

7.1.2opencv中调用Canny函数边缘检测:#include <opencv2\opencv.hpp>#include<opencv2/highgui/highgui.hpp>#include<opencv2/imgproc/imgproc.hpp>using namespace cv;int main(){ Mat img = imread("sg.jpg");//名为sg.jpg的图片一定要与.cpp文件同路径。 Mat src1 = img.

2020-07-22 14:40:14 133

原创 opencv3编程入门(第六章6.5-6.7)

6.5,漫水填充#include<opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include<iostream>using namespace cv;using namespace std;#include <opencv2/imgproc/imgproc.hpp>//全局变量的声明Mat g_srcImage, g_dstImage,g_grayImage,g_ma

2020-06-17 10:28:33 139

原创 opencv3编程入门(第六章6.1-6.4)

6.1线性滤波:方框滤波,均值滤波,高斯滤波综合实例:#include<opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include<iostream>using namespace cv;using namespace std;#include <opencv2/imgproc/imgproc.hpp>//全局变量的声明Mat g_srcImage, g_dstIma

2020-06-16 16:41:04 221

原创 opencv3编程入门(第五章5.2.3-5.6.4)

5.2.3图片的ROI区域混合:#include<opencv2/opencv.hpp>#include <opencv2/highgui/highgui.hpp>using namespace cv;using namespace std;#include<iostream>bool ROI_LinearBlending();int main(){ system("color 5E"); if (ROI_LinearBlending()) {cou

2020-06-12 18:09:14 129

原创 opencv3编程入门毛星云(第五章节5.2)

5.2ROI区域图像叠加:#include<opencv2/opencv.hpp>#include <opencv2/highgui/highgui.hpp>using namespace cv;using namespace std;#include<iostream>bool ROI_AddImage();int main(){ system("color 5E"); if (ROI_AddImage()) {cout << "ROI

2020-06-11 17:32:33 261

原创 opencv3编程入门毛星云(第四章节4.3)

opencv3,编程入门4.3基本图形的绘制:#include<opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include<opencv2/imgproc/imgproc.hpp>using namespace cv;using namespace std;#include <iostream>#include <string>#define WINDOW

2020-06-10 15:58:38 152

原创 C++多态性与虚函数(谭浩强12.1-12.4)

例12.1,一个典型的建立点、面、体的静态多态性例子:#include <iostream>using namespace std;class Point{public: Point(float x = 0, float y = 0); void setPoint(float, float); float getX()const{ return x; }//读x坐标,g...

2020-05-07 11:22:24 334

原创 C++继承与派生(谭浩强11.8-11.10)

例11.8多重继承派生类的构造函数:#include <iostream>using namespace std;#include<string>class Teacher//声明基类{public://基类公用成员 Teacher(string nam,int a,string t )//基类构造函数 { name = nam; age=a; ...

2020-05-06 17:06:38 309

原创 C++继承与派生(谭浩强11.1-11.7)

例11.1

2020-05-06 14:28:07 342

原创 C++运算符重载(谭浩强10.6-10.10)

例10.6 后置自增运算符++的重载#include <iostream>using namespace std;#include<string>class Time{public: Time(){ minute = 0; sec = 0; }//默认构造函数 Time(int m, int s) :minute(m), sec(s){}//构造函数重载 ...

2020-05-04 17:05:23 210

原创 C++运算符重载(谭浩强10.1-10.5)

例10.1 通过函数来实现复数相加#include <iostream>using namespace std;class Complex{public: Complex(){ real = 0; imag = 0; }//在类内定义构造函数 Complex(double r, double i){ real = r; imag = i; } //构造函数重载并定义 ...

2020-05-04 15:47:24 240

原创 C++使用类和对象(谭浩强9.8-9.14)

例9.8 对象的引用#include <iostream>using namespace std;class Time{public: Time(int, int, int);//声明构造函数 int hour; int minute; int sec;};Time::Time(int h, int m, int s)//定义构造函数{ hour = h; ...

2020-05-03 12:01:11 244

原创 C++使用类和对象(谭浩强9.1-9.7)

例9.1 在例8.3的基础上,用构造函数为对象的数据成员赋初值#include <iostream>using namespace std;class Time//声明Time类{public: Time()//定义构造成员函数,函数名与类名相同 { hour = 0; minute = 0; sec = 0; } void set_time();//成员...

2020-04-30 14:34:44 274

原创 C++类和对象的特性(谭浩强8.2-8.4)

例8.2 利用Time类,定义多个对象,分别输入和输出对象中的时间:#include <iostream>using namespace std;class Time{public: int hour; int minute; int sec;};int main(){ void set_time(Time&); void show_time(Time...

2020-04-29 16:08:14 196

原创 C++自定义数据类型(谭浩强7.5-7.7)

例7.5 用结构体变量作函数参数#include <iostream>#include <string>using namespace std;struct Student //声明结构体类型{ int num; string name;//此处原文是char编译出错,改为string编译正确 float score[3];};int main(){...

2020-04-29 11:34:55 144

原创 C++自定义数据类型(谭浩强7.1-7.4)

例7.1:定义两个结构体变量student1和student2,初始化并赋值;#include<iostream> using namespace std;struct Date // 声明结构体类型Date{ int month; int day; int year;};struct Student //声明结构体类型Student{ int num; cha...

2020-04-09 15:12:42 196

原创 C++程序设计之指针与引用(谭浩强6.15-6.19)

例6.15:通过引用得到变量的值:#include<iostream> using namespace std;#include<iomanip>int main(){ int a = 10; int &b = a; //声明 b是a的引用 a = a*a; cout << a << setw(6) << b &...

2020-03-31 14:47:56 156

原创 C++程序设计之指针与引用(谭浩强6.5-6.13)

例6.5 指针变量指向数组元素并输出;#include<iostream> #include<string>using namespace std;int main(){ int a[10]; int i, *p = a; for (i = 0; i < 10; i++) cin >> *(p + i); cout << ...

2020-03-31 10:38:55 175

原创 C++程序设计之指针与引用(谭浩强6.1-6.4)

例6.1通过指针访问整型变量#include<iostream> #include<string>using namespace std;int main(){ int a, b ; int*pointer_1, *pointer_2; a = 100; b = 10; pointer_1 = &a; pointer_2 = &b; c...

2020-03-30 10:39:03 174

原创 C++程序设计之数组(谭浩强5.9-5.12)

例5.9设计和输出一个钻石图形#include<iostream> using namespace std;int main(){ char diamond[][5] = { { ' ', ' ', '*' }, { ' ', '*', ' ', '*' }, { '*', ' ', ' ', ' ', '*' }, { ' ', '*', ' ', '*' },{' ',...

2020-03-26 17:01:13 195

原创 C++程序设计之数组(谭浩强5.1-5.7)

例5.1定义一个数组并按逆序输出:#include<iostream> using namespace std;int max(int, int);int main(){ int i,a[10]; for (i = 0; i <= 9; i++) a[i] = i; //使a[0]-a[9]的值为0-9 for (i = 9; i >= 0; i--) ...

2020-03-26 14:41:04 186

原创 C++学习之extern声明外部变量(谭浩强4.12)

用extern对变量作外部变量声明:#includeusing namespace std;int max(int, int);int main(){extern int a, b; //对全局变量a,b做提前引用声明cout << max(a, b) << endl;return 0;}int a = 15, b = -7; //定义全局变量int...

2020-03-25 14:38:39 183

原创 C++学习之函数的重载和函数模板(谭浩强4.8-4.9)

4.8函数的重载不仅允许函数的参数类型不同,还允许函数参数的个数不同(但是参数个数和类型同时相同时不能使用重载)#includeusing namespace std;int main(){int max(int a, int b, int c);double max(double a, double b, double c);long max(long a, long b, lon...

2020-03-25 10:32:31 200 1

原创 C++学习之内置函数(谭浩强4.7)

4.7:内置函数的练习。注意:只有规模较小而又被频繁调用的简单函数才适合声明为inline函数,(不包括复杂的控制语句和循环语句)。#includeusing namespace std;inline int max(int, int, int);//声明内置函数int main(){int i = 0, j = 20, k = 30, m;m = max(i, j, k);cou...

2020-03-25 09:45:42 135

原创 C++学习之函数的嵌套调用和用递归法求n!(谭浩强)

C++中不允许对函数作嵌套定义,但是可以对函数作嵌套调用!#include#include#includeusing namespace std;int main(){int max_4(int a, int b, int c, int d);int a, b, c, d, max;cout<<“please enter 4interger numbers:”<...

2020-03-24 11:08:08 1448

原创 在图像中检测圆并指定圆心和半径的图像区域ROI(抠图)。

在图像中检测圆并指定圆心和半径的图像区域ROI(抠图)。# 加载环境包import cv2import numpy as npimport scipy.miscimport matplotlib.pyplot as pltfrom matplotlib.ticker import MultipleLocator# 图片简单处理img = cv2.imread('G:/Ubuntu/...

2019-12-12 16:53:18 2423

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除