
笔记
lnplnp_
这个作者很懒,什么都没留下…
展开
-
【快速入门 C++ STL】 demo 演示一:string
/*********************//* demo string *//*********************/#define _SCL_SECURE_NO_WARNINGS #include<string>#include<iostream>#include<algorithm>using namespace std...原创 2018-07-30 10:46:03 · 191 阅读 · 0 评论 -
【opencv自学笔记】09:模板匹配
找出模板图片所在的位置读入图片——模板匹配(三种方法)差值平方和匹配 CV_TM_SQDIFF 标准化差值平方和匹配 CV_TM_SQDIFF_NORMED 相关匹配 CV_TM_CCORR 标准相关匹配 CV_TM_CCORR_NORMED 相关匹配 CV_TM_CCOEFF 标准相关匹配 CV_TM_CCOEFF_NORMED"""模板匹配"""import cv2...原创 2018-08-09 21:33:55 · 226 阅读 · 0 评论 -
【opencv自学笔记】10上:图像二值化
# -*- coding: utf-8 -*-"""二值化图像"""import cv2 as cvimport numpy as np#全局二值化def threshold_demo(image): gray=cv.cvtColor(image,cv.COLOR_BGR2GRAY) #cv.THRESH_OTSU OTSU算法自适应阈值 cv.TH...原创 2018-08-10 17:34:57 · 238 阅读 · 0 评论 -
【opencv自学笔记】10下:超大图像二值化
先分块,在局部二值化# -*- coding: utf-8 -*-"""超大图像二值化图像ROI与空白图像过滤局部阈值图像二值化@author: LNP"""import cv2 as cvimport numpy as npdef big_image_demo(image): gray=cv.cvtColor(image,cv.COLOR_BGR2GRAY) ...原创 2018-08-11 10:36:53 · 320 阅读 · 0 评论 -
【opencv自学笔记】11:图像金字塔
# -*- coding: utf-8 -*-"""Created on Sat Aug 11 10:43:03 2018高斯金字塔reduce=高斯模糊+降采样expend=扩大+卷积@author: LNP"""import cv2 as cv#高斯金字塔def guasian_pyramid_demo(image): level=3 tmp=im...原创 2018-08-11 11:21:50 · 179 阅读 · 0 评论 -
【opencv自学笔记】12上:边缘提取 sobel laplace
# -*- coding: utf-8 -*-"""sobel 边缘提取 一阶导数拉普拉斯边缘提取 二阶导数@author: LNP"""import cv2 as cvimport numpy as np#拉普拉斯默认4卷积核def laplace_demo(image): lpls=cv.Laplacian(image,cv.CV_32F) dst=cv...原创 2018-08-11 11:59:25 · 383 阅读 · 0 评论 -
【opencv自学笔记】12下:边缘提取 cany
1、高斯模糊2、灰度转换3、计算梯度4、非最大信号抑制5、高低阈值输出二值图像# -*- coding: utf-8 -*-"""canny边缘提取1、高斯模糊2、灰度转换3、计算梯度4、非最大信号抑制5、高低阈值输出二值图像@author: LNP"""import cv2 as cvimport numpy as npdef edge_demo(imag...原创 2018-08-11 12:40:12 · 487 阅读 · 0 评论 -
【opencv自学笔记】13:霍夫直线检测
转换灰度图——边缘检测——霍夫线变换# -*- coding: utf-8 -*-"""霍夫直线检测转换灰度图,边缘检测,霍夫线变换@author: LNP"""import cv2 as cvimport numpy as np#标准霍夫线变换 贯穿非直线def line_detect_demo(image): copying=image.copy() ...原创 2018-08-11 16:31:33 · 344 阅读 · 0 评论 -
【opencv自学笔记】14:霍夫圆检测
霍夫圆检测边缘保留滤波——转灰度图——霍夫圆检测# -*- coding: utf-8 -*-"""霍夫圆检测边缘保留滤波————转灰度图————霍夫圆检测@author: LNP"""import cv2 as cvimport numpy as npdef detect_circle_demo(image): #hough圆检测对噪声敏感,必须滤波 b...原创 2018-08-11 17:24:38 · 1178 阅读 · 0 评论 -
【python】入门笔记二 :基本函数运用
1def recursion(n): if n==1: return 1 else: return n+recursion(n-1)recursion(100) 2ch=0num=0space=0other=0def count(str): global ch,num,space,other for ...原创 2018-08-07 16:57:15 · 265 阅读 · 0 评论 -
【opencv自学笔记】03:像素运算
加减乘除;逻辑与或非;求均值方差;图片融合改变对比度亮度import cv2 as cvimport numpy as npdef add_demo(src1,src2): dst=cv.add(src1,src2) cv.imshow('add',dst)def sub_demo(src1,src2): dst=cv.subtract(src1,src2)...原创 2018-08-08 15:27:14 · 177 阅读 · 0 评论 -
【opencv自学笔记】02:色彩空间
RGB转化灰度图,HSV,动态捕获特定颜色的物体import cv2 as cvimport numpy as np#颜色空间def color_space_demo(image): gray=cv.cvtColor(image,cv.COLOR_BGR2GRAY) yuv=cv.cvtColor(image,cv.COLOR_BGR2YUV) hsv=cv...原创 2018-08-08 15:26:58 · 222 阅读 · 0 评论 -
【opencv自学笔记】01:图像加载保存,numpy操作
获取图片信息,从视频保存图片,颜色反转(逻辑非),计时import cv2 as cvimport numpy as np#获取图像信息def get_image_info(image): print(type(image)) print(image.shape) print(image.size) print(image.dtype) pixe...原创 2018-08-08 15:26:43 · 717 阅读 · 0 评论 -
【C++实现】并查集 6个版本 从入门到优化
#ifndef __UF__H__#define __UF__H__#include<cassert>//只记录id值,和哪个节点联通,效率最低class UF1{private: int *id; int count;public: UF1(int n){ count = n; id = new int[n]; for (size_t i = 0;...原创 2018-09-05 16:45:08 · 236 阅读 · 0 评论 -
【opencv自学笔记】08下:图像直方图应用
直方图反向投影,物体追踪,找出种子图片色彩空间对应的物体读入图像——转HSV空间——计算sample直方图——归一化——计算反射投影import cv2 as cvfrom matplotlib import pyplot as pltimport numpy as np#直方图反向投影,物体追踪,找出种子图片色彩空间对应的物体#读入图像——转HSV空间——计算sample直方图...原创 2018-08-09 20:37:54 · 243 阅读 · 0 评论 -
【python】入门笔记一 :基本语法
11a=input()b=[]for i in a: b.append(ord(i))print(b)2import matha=int(input('a:'))b=int(input('b:'))c=int(input('c:'))if a+b<=c or a+c<=b or b+c<=a : print('不是三角形')el...原创 2018-08-05 16:44:37 · 326 阅读 · 0 评论 -
【opencv自学笔记】08中:图像直方图应用
通过直方图比较图像相似度import cv2 as cvfrom matplotlib import pyplot as pltimport numpy as np#直方图均衡化 增强对比度def equalHist_demo(image): gray=cv.cvtColor(image,cv.COLOR_BGR2GRAY) cv.imshow('gray',gray...原创 2018-08-09 16:31:46 · 276 阅读 · 0 评论 -
【快速入门 C++ STL】 demo 演示二:vector
/*********************//* demo vector *//*********************/#include<vector>#include<iostream>using namespace std;//遍历打印void printFun(vector<int> &obj){ for (...原创 2018-07-30 11:42:42 · 195 阅读 · 0 评论 -
【快速入门 C++ STL】 demo 演示三:deque
deque 结合了vector的全部功能和list的首尾插入删除功能/*********************//* demo deque *//*********************/#include<deque>#include<iostream>using namespace std;//遍历打印void printFun(de...原创 2018-07-30 11:58:16 · 149 阅读 · 0 评论 -
【快速入门 C++ STL】 demo 演示四:stack
stack模型先进后出#include<stack>#include<iostream>using namespace std;int main(){ stack<int> s; for (size_t i = 0; i < 10; i++) { s.push(i); } while (!s.empty()) { int...原创 2018-07-30 12:18:46 · 184 阅读 · 0 评论 -
【快速入门 C++ STL】 demo 演示五:queue
queue模型先进先出#include<queue>#include<iostream>using namespace std;int main(){ queue<int> s; for (size_t i = 0; i < 10; i++) { s.push(i); } while (!s.empty()) { int...原创 2018-07-30 12:24:11 · 170 阅读 · 0 评论 -
【快速入门 C++ STL】 demo 演示六:list
list双向列表不能随机访问#include<list>#include<iostream>using namespace std;void printFun(list<int> &obj){ for (list<int>::iterator it = obj.begin(); it != obj.end(); it++)...原创 2018-07-30 12:50:24 · 231 阅读 · 0 评论 -
【快速入门 C++ STL】 demo 演示七:set/multiset
#include<set>#include<iostream>#include<functional>#include<string>using namespace std;class student{public: student(int ID,string name) { this->ID = ID; this...原创 2018-07-30 17:11:51 · 356 阅读 · 0 评论 -
【快速入门 C++ STL】 demo 演示八:map/multimap
#include<map>#include<string>#include<iostream>using namespace std;void printFun(map<int, string> &obj){ for (map<int, string>::iterator it = obj.begin(); it ...原创 2018-07-30 20:02:06 · 182 阅读 · 0 评论 -
【快速入门 C++ STL】 demo 演示九:二元谓词,二元函数对象,函数适配器
#include<vector>#include<iostream>#include<algorithm>#include<functional>using namespace std;template <typename T>class sum//二元函数对象{public: T operator()(T &...原创 2018-07-30 21:58:14 · 377 阅读 · 1 评论 -
【opencv自学笔记】04:ROI与泛洪填充
指颜色定区间内的像素填充floodFill(copying,mask,start_point,filled_color,lower,higth,cv.FLOODFILL_FIXED_RANGE)与二值图像的填充,只在mask填充floodFill(copying,mask,start_point,filled_color,cv.FLOODFILL_MASK_ONLY)import...原创 2018-08-09 10:01:59 · 239 阅读 · 0 评论 -
【opencv自学笔记】05:模糊操作
均值,中值,自定义模糊,锐化import cv2 as cvimport numpy as np#blur(src,卷积核) 均值模糊 适合消除随机噪声,领域内平均值def blur_demo(image): dst=cv.blur(image,(2,15)) cv.imshow("blur_demo",dst)#medianBlur(src,卷积核) 中值模糊 ...原创 2018-08-09 10:41:10 · 139 阅读 · 0 评论 -
【opencv自学笔记】06:高斯模糊
加高斯噪声,高斯模糊import cv2 as cvimport numpy as np#计时,装饰器def decorate_time(func): def wrapper(src): t1=cv.getTickCount() func(src) t2=cv.getTickCount() print('time...原创 2018-08-09 11:13:39 · 249 阅读 · 0 评论 -
【opencv自学笔记】07:边缘保留滤波EPF
两个APIbilateralFilter 双边滤波pyrMeanShiftFiltering 均值偏移滤波import cv2 as cvimport numpy as np#边缘保留滤波#高斯双边滤波 def bi_demo(image): dst=cv.bilateralFilter(image,0,100,30) cv.imshow('bi_demo'...原创 2018-08-09 12:23:24 · 631 阅读 · 0 评论 -
【opencv自学笔记】08上:图像直方图
提取直方图#pip install matplotlibfrom matplotlib import pyplot as pltimport cv2 as cvdef plot_demo(image): plt.hist(image.ravel(),256,[0,256])#hist(src,bin,[,]) plt.show("直方图")def image_d...原创 2018-08-09 16:30:28 · 148 阅读 · 0 评论 -
【C++实现】基本排序算法 插入排序——归并排序——快速排序——堆排序
/*排序总结:(基于100w随机数,有序数、重复数测试)1、插入排序适合近乎有序的序列2、归并排序优化:(优化前 120S)1)数据小于15时采用插入排序 10S2)避免频繁动态申请内存 memcpy(dest,src,sizeof(int)*len) 用static 变量 0.2S缺点:需要O(N)的空间复杂度3、快速排序优化:(优化前 如果序列完全有序,则...原创 2018-09-05 16:48:56 · 450 阅读 · 0 评论