Python+OpenCV:图像二进制鲁棒独立基本特征(BRIEF, Binary Robust Independent Elementary Features)

理论

We know SIFT uses 128-dim vector for descriptors. Since it is using floating point numbers, it takes basically 512 bytes. Similarly SURF also takes minimum of 256 bytes (for 64-dim).

Creating such a vector for thousands of features takes a lot of memory which are not feasible for resource-constraint applications especially for embedded systems. Larger the memory, longer the time it takes for matching.

But all these dimensions may not be needed for actual matching. We can compress it using several methods like PCA, LDA etc.

Even other methods like hashing using LSH (Locality Sensitive Hashing) is used to convert these SIFT descriptors in floating point numbers to binary strings.

These binary strings are used to match features using Hamming distance.

This provides better speed-up because finding hamming distance is just applying XOR and bit count, which are very fast in modern CPUs with SSE instructions.

But here, we need to find the descriptors first, then only we can apply hashing, which doesn't solve our initial problem on memory.

BRIEF comes into picture at this moment. It provides a shortcut to find the binary strings directly without finding descriptors.

It takes smoothened image patch and selects a set of nd (x,y) location pairs in an unique way (explained in paper). Then some pixel intensity comparisons are done on these location pairs.

For eg, let first location pairs be p and q. If I(p)<I(q), then its result is 1, else it is 0. This is applied for all the nd location pairs to get a nd-dimensional bitstring.

This nd can be 128, 256 or 512. OpenCV supports all of these, but by default, it would be 256 (OpenCV represents it in bytes. So the values will be 16, 32 and 64).

So once you get this, you can use Hamming Distance to match these descriptors.

One important point is that BRIEF is a feature descriptor, it doesn't provide any method to find the features. So you will have to use any other feature detectors like SIFT, SURF etc.

The paper recommends to use CenSurE which is a fast detector and BRIEF works even slightly better for CenSurE points than for SURF points.

In short, BRIEF is a faster method feature descriptor calculation and matching. It also provides high recognition rate unless there is large in-plane rotation.

BRIEF in OpenCV

####################################################################################################
# 图像二进制鲁棒独立基本特征(BRIEF, Binary Robust Independent Elementary Features)
def lmc_cv_image_binary_robust_detection():"""函数功能: 图像二进制鲁棒独立基本特征(BRIEF, Binary Robust Independent Elementary Features)。"""stacking_images = []image_file_name = ['D:/99-Research/Python/Image/Butterfly01.jpg','D:/99-Research/Python/Image/Butterfly02.jpg','D:/99-Research/Python/Image/Butterfly03.jpg','D:/99-Research/Python/Image/Butterfly04.jpg']for i in range(len(image_file_name)):# 读取图像image = lmc_cv.imread(image_file_name[i])image = lmc_cv.cvtColor(image, lmc_cv.COLOR_BGR2RGB)gray_image = lmc_cv.cvtColor(image, lmc_cv.COLOR_BGR2GRAY)# Initiate FAST detectorstar = lmc_cv.xfeatures2d.StarDetector_create()# Initiate BRIEF extractorbrief = lmc_cv.xfeatures2d.BriefDescriptorExtractor_create()# find the keypoints with STARkeypoints = star.detect(gray_image, None)# compute the descriptors with BRIEFkeypoints, descriptors = brief.compute(gray_image, keypoints)print("描述子个数: {}".format(brief.descriptorSize()))print("描述子形状:{}".format(descriptors.shape))result_image = lmc_cv.drawKeypoints(gray_image, keypoints, None, color=(255, 0, 0),flags=lmc_cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)# stacking images side-by-sidestacking_image = np.hstack((image, result_image))stacking_images.append(stacking_image)# 显示图像for i in range(len(stacking_images)):pyplot.figure('Binary Robust Independent Elementary Features %d' % (i + 1))pyplot.subplot(1, 1, 1)pyplot.imshow(stacking_images[i], 'gray')pyplot.title('Binary Robust Independent Elementary Features')pyplot.xticks([])pyplot.yticks([])pyplot.show()# 根据用户输入保存图像if ord("q") == (lmc_cv.waitKey(0) & 0xFF):# 销毁窗口pyplot.close('all')return

Python+OpenCV:图像二进制鲁棒独立基本特征(BRIEF, Binary Robust Independent Elementary Features)相关推荐

  1. OpenCV中的二进制鲁棒独立基本特征——BRIEF

    OpenCV中的二进制鲁棒独立基本特征--BRIEF 1. 效果图 2. 源码 参考 这篇博客将介绍OpenCV中的二进制鲁棒独立基本特征.BRIEF是一种更快的特征描述符计算和匹配方法.它还提供了较 ...

  2. OpenCV系列之BRIEF(二进制的鲁棒独立基本特征) | 四十二

    目标 在本章中, 我们将看到BRIEF算法的基础知识 理论 我们知道SIFT使用128维矢量作为描述符.由于它使用浮点数,因此基本上需要512个字节.同样,SURF最少也需要256个字节(用于64像素 ...

  3. OpenCV-Python BRIEF(二进制的鲁棒独立基本特征) | 四十二

    目标 在本章中,我们将看到BRIEF算法的基础知识 理论 我们知道SIFT使用128维矢量作为描述符.由于它使用浮点数,因此基本上需要512个字节.同样,SURF最少也需要256个字节(用于64像素) ...

  4. (四)OpenCV中的特征检测之BRIEF(二进制强大的独立基本特征)

    注释:本文翻译自OpenCV3.0.0 document->OpenCV-Python Tutorials,包括对原文档种错误代码的纠正 1.概述 SIFT使用具有128个浮点数的特征描述符. ...

  5. python opencv图像二值化函数_python opencv 二值化 计算白色像素点的实例

    python opencv 二值化 计算白色像素点的实例 贴部分代码 #! /usr/bin/env python # -*- coding: utf-8 -*- import cv2 import ...

  6. python opencv 图像膨胀

    python opencv 图像膨胀 代码: import cv2 import numpy as np # 图像膨胀 def dilate_img(img,a,iterations):kernel ...

  7. python opencv 图像旋转

    python opencv 图像旋转 原图 顺时针旋转 代码: import cv2 path = '2.jpg' img = cv2.imread(path,1) trans_img = cv2.t ...

  8. 【Python+OpenCV 图像透视变换 warpPerspective函数】

    Python+OpenCV 图像透视变换 warpPerspective函数 1.函数介绍 2.代码实例 3.实现效果 1.函数介绍 warpPerspective():对图像进行透视变换.简单来说, ...

  9. 【Python+OpenCV 图像的缩放和裁剪】

    Python+OpenCV 图像的缩放和裁剪 代码部分 实现效果 代码部分 import cv2 import numpy as npimg = cv2.imread("Photos/1.b ...

最新文章

  1. Tesseract 3.02 OCR文字识别调查记录
  2. VTK修炼之道8_三维场景基本要素:相机
  3. Spark Streaming从Kafka中拉取数据,并且使用过“窗口函数”统计一些流量信息
  4. 高德地图 街道范围_高德地图发布交通“评诊治”系统:针对各类交通拥堵场景“因地制宜”...
  5. 全国高等学校计算机等级用处,全国计算机等级考试一级有什么用
  6. heatmap个人简单理解
  7. windows10中屏幕键盘 vs 触摸键盘
  8. dockerfile入门
  9. tcpdump抓包分析
  10. 神舟k650d i5 d3安装EI Capitan问题总结
  11. java 对象转换成map_Java中对象(Object)转换成Map
  12. 华为路由器配置NAT
  13. win7美化_Windows桌面图标和分类美化小工具
  14. 需求与商业模式分析-6-五个课题
  15. 路由器、交换机设备管理
  16. 如何更换计算机cpu风扇,cpu风扇怎么拆下来 cpu风扇正确拆卸方法图解
  17. html5怎么写副标题,论文指导:论文题目副标题怎么写
  18. python开发app教程_知到APP_数据库应用与开发_答案教程
  19. STM32 TIM高级定时器死区时间的计算
  20. [好消息]大连.NET俱乐部QQ群开放注册~~~注册有好礼!

热门文章

  1. IDEA 配置 SpringBoot 启动端口
  2. Java开发笔记(八十八)文件字节I/O流
  3. pg_rewind 快速角色切换
  4. python开发基础作业02:三级菜单,使用字典dic及列表
  5. linux的/dev内容介绍
  6. DataTable中的数据导出Excel文件
  7. 在线中英文符号转换工具
  8. 在线邮箱地址提取工具
  9. Nodejs教程09:实现一个带接口请求的简单服务器
  10. 数据实验室:让您的数据获得真正的价值