GithubHelp home page GithubHelp logo

darkfunct / opencv_train Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guanfuchen/opencv_train

0.0 0.0 0.0 9.78 MB

记录图像处理相关算法openv实现

CMake 0.01% Jupyter Notebook 99.74% C++ 0.03% Python 0.23%

opencv_train's Introduction

opencv_train

记录图像处理常用算法及其opencv实现。


颜色空间转换

参考opencv函数cvtColor,实现RGB、BGR、GRAY等颜色空间转换,示例代码可以参考ColorChange

  • RGB2GRAY $$gray = 0.299r + 0.587g + 0.114*b$$ RGB颜色空间转换为灰度图。
  • BGR2HSV HSV颜色空间为亮度、饱和度和对比度,可以用来捕捉某些特定颜色的物体(H)。

cvtColor


图形绘制

在图像中绘制直线、圆、椭圆、矩形、文字等,实现可参考ImageDraw


图像滤波

介绍中值滤波、双线性滤波、高斯滤波等常用图像滤波算法,实现可参考ImageFilter


阈值化操作

增加阈值化介绍,包括简单阈值和自适应阈值。


图像算术

介绍常用图像算术操作,包括add、sub等,实现可参考ImageOperate


图像梯度

介绍常用图像梯度计算操作,包括sobel、laplacian等,实现可参考ImageGradient


几何变换

介绍图像常用几何变换,包括图像平移、图像旋转、图像缩放等,实现可参考ImageTransform


视频操作

介绍OpenCV中常用视频操作,包括read帧,write帧等,实现可参考VideoOperate


霍夫变换

介绍霍夫变换在直线、圆检测上的原理和应用,实现可参考hough_transform


Canny边缘检测

Canny边缘检测是一种非常流行的边缘检测算法,是John在1986年提出的,实现可参考CannyDetection,使用numpy对每一步进行了实现。

Wasnik_01_01.ipynb

Canny边缘检测算法的实现

Canny算法 边缘检测


图像金字塔

一般情况下,我们要处理一副具有固定分辨率的图像,但是在有些情况下,我们需要对同一图像的不同分辨率的子图像进行处理。比如,我们要在一副图像中查找某个目标,比如脸,我们不知道目标在图像中的尺寸大小。这种情况下,我们需要创建一组图像,这些图像是具有不同分辨率的原始图像,这些图像构成了图像金字塔(同一图像的不同分辨率的子图集合),实现可参考Pyramid


图像特征与描述

角点corner是一个好的图像特征。找到图像特征的技术被称为特征检测。特征匹配使用特征描述。


Harris角点检测

角点特性:像任何方向移动变化都很大。其中Harris角点是Harris和Mike在1988年提出的,他将这个特性转换为数学形式,即窗口想各个方向移动(u,v)然后计算所有差异的总和,公式如下: $$E(u,v)=\sum_{x,y}{w(x,y)[I(x+u, y+v)-I(x,y)]^2}$$


SIFT特征提取

介绍SIFT特征提取。


插值算法

增加插值算法,包括双线性插值,线性插值,主要应用在图像缩放上。

線性內插(Interpolation)

双线性插值(Bilinear Interpolation)


BOF词袋模型

增加bag of feature词袋模型。


常用函数

RGB2BGR

import cv2
def bgr_to_rgb(bgr):
    rgb = cv2.cvtColor(bgr, cv2.COLOR_BGR2RGB)
    return rgb
def rgb_to_bgr(rgb):
    bgr = cv2.cvtColor(rgb, cv2.COLOR_RGB2BGR)
    return bgr

常用算法详解


HOG

增加HOG详解。


Haar

增加Haar描述子详解。


LBP

增加LBP描述子详解,实现理解相关资料参考lbp


光流算法

增加光流相关算法。


角点检测的FAST算法

增加角点检测的FAST算法。


常用函数


计算梯度$g_x$和$g_y$的幅值和方向

$$g=\sqrt{g_x^2+g_y^2}$$ $$\theta=\arctan{\frac{g_y}{g_x}}$$

# Python gradient calculation
# Read image
import cv2
import numpy as np
im = cv2.imread('lena.jpg')
im = np.float32(im) / 255.0
# Calculate gradient
gx = cv2.Sobel(im, cv2.CV_32F, 1, 0, ksize=1)
gy = cv2.Sobel(im, cv2.CV_32F, 0, 1, ksize=1)
# Python Calculate gradient magnitude and direction ( in degrees )
mag, angle = cv2.cartToPolar(gx, gy, angleInDegrees=True)

Histogram of Oriented Gradients


源码分析

增加源码分析,参考OpenCV源码分析


参考资料

CAP 5415 - Computer Vision 按照公开课学习。

OpenCV-Python-Tutorial 该仓库是OpenCV-Python代码,其中有大量开源代码和示例数据。

opencv python2 samples opencv仓库中python相关示例。

ComputerVision github 作者也是基于大量的代码结合公式进行分类。

opencv_train's People

Contributors

guanfuchen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.