OpenCV之图像积分图算法

Posted MachineLP

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenCV之图像积分图算法相关的知识,希望对你有一定的参考价值。

python代码:

import cv2 as cv
import numpy as np


def get_block_sum(ii, x1, y1, x2, y2, index):
    tl = ii[y1, x1][index]
    tr = ii[y2, x1][index]
    bl = ii[y1, x2][index]
    br = ii[y2, x2][index]
    s = (br - bl - tr + tl)
    return s


def blur_demo(image, ii):
    h, w, dims = image.shape
    result = np.zeros(image.shape, image.dtype)
    ksize = 15
    radius = ksize // 2
    for row in range(0, h + radius, 1):
        y2 = h if (row + 1)> h else (row + 1)
        y1 = 0 if (row - ksize) < 0 else (row - ksize)
        for col in range(0, w + radius, 1):
            x2 = w if (col + 1)>w else (col + 1)
            x1 = 0 if (col - ksize) < 0 else (col - ksize)
            cx = 0 if (col - radius) < 0 else (col - radius)
            cy = 0 if (row - radius) < 0 else (row - radius)
            num = (x2 - x1)*(y2 - y1)
            for i in ran

以上是关于OpenCV之图像积分图算法的主要内容,如果未能解决你的问题,请参考以下文章

OpenCV中积分图介绍与应用

图像处理之积分图应用四(基于局部均值的图像二值化算法)

OpenCv关于灰度积分图的SSE代码学习和改进。

OpenCV实战(10)——积分图像详解

Opencv3中SURF算法学习

OpenCV之快速的图像边缘滤波算法