/* This is AGAST and OAST, an optimal and accelerated corner detector
based on the accelerated segment tests
Below is the original copyright and the references */
/*
Copyright (C) 2010 Elmar Mair
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
*Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
*Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
*Neither the name of the University of Cambridge nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
The references are:
* Adaptive and Generic Corner Detection Based on the Accelerated Segment Test,
Elmar Mair and Gregory D. Hager and Darius Burschka
and Michael Suppa and Gerhard Hirzinger ECCV 2010
URL: http://www6.in.tum.de/Main/ResearchAgast
*/
#include "agast_score.hpp"
#ifdef _MSC_VER
#pragma warning( disable : 4127 )
#endif
namespace cv
{
void makeAgastOffsets(int pixel[16], int rowStride, int type)
{
static const int offsets16[][2] =
{
{-3, 0}, {-3, -1}, {-2, -2}, {-1, -3}, {0, -3}, { 1, -3}, { 2, -2}, { 3, -1},
{ 3, 0}, { 3, 1}, { 2, 2}, { 1, 3}, {0, 3}, {-1, 3}, {-2, 2}, {-3, 1}
};
static const int offsets12d[][2] =
{
{-3, 0}, {-2, -1}, {-1, -2}, {0, -3}, { 1, -2}, { 2, -1},
{ 3, 0}, { 2, 1}, { 1, 2}, {0, 3}, {-1, 2}, {-2, 1}
};
static const int offsets12s[][2] =
{
{-2, 0}, {-2, -1}, {-1, -2}, {0, -2}, { 1, -2}, { 2, -1},
{ 2, 0}, { 2, 1}, { 1, 2}, {0, 2}, {-1, 2}, {-2, 1}
};
static const int offsets8[][2] =
{
{-1, 0}, {-1, -1}, {0, -1}, { 1, -1},
{ 1, 0}, { 1, 1}, {0, 1}, {-1, 1}
};
const int (*offsets)[2] = type == AgastFeatureDetector::OAST_9_16 ? offsets16 :
type == AgastFeatureDetector::AGAST_7_12d ? offsets12d :
type == AgastFeatureDetector::AGAST_7_12s ? offsets12s :
type == AgastFeatureDetector::AGAST_5_8 ? offsets8 : 0;
CV_Assert(pixel && offsets);
int k = 0;
for( ; k < 16; k++ )
pixel[k] = offsets[k][0] + offsets[k][1] * rowStride;
}
// 16 pixel mask
template<>
int agast_cornerScore<AgastFeatureDetector::OAST_9_16>(const uchar* ptr, const int pixel[], int threshold)
{
int bmin = threshold;
int bmax = 255;
int b_test = (bmax + bmin) / 2;
short offset0 = (short) pixel[0];
short offset1 = (short) pixel[1];
short offset2 = (short) pixel[2];
short offset3 = (short) pixel[3];
short offset4 = (short) pixel[4];
short offset5 = (short) pixel[5];
short offset6 = (short) pixel[6];
short offset7 = (short) pixel[7];
short offset8 = (short) pixel[8];
short offset9 = (short) pixel[9];
short offset10 = (short) pixel[10];
short offset11 = (short) pixel[11];
short offset12 = (short) pixel[12];
short offset13 = (short) pixel[13];
short offset14 = (short) pixel[14];
short offset15 = (short) pixel[15];
while(true)
{
const int cb = *ptr + b_test;
const int c_b = *ptr - b_test;
if(ptr[offset0] > cb)
if(ptr[offset2] > cb)
if(ptr[offset4] > cb)
if(ptr[offset5] > cb)
if(ptr[offset7] > cb)
if(ptr[offset3] > cb)
if(ptr[offset1] > cb)
if(ptr[offset6] > cb)
if(ptr[offset8] > cb)
goto is_a_corner;
else
if(ptr[offset15] > cb)
goto is_a_corner;
else
goto is_not_a_corner;
else
if(ptr[offset13] > cb)
if(ptr[offset14] > cb)
if(ptr[offset15] > cb)
goto is_a_corner;
else
goto is_not_a_corner;
else
goto is_not_a_corner;
else
goto is_not_a_corner;
else
if(ptr[offset8] > cb)
if(ptr[offset9] > cb)
if(ptr[offset10] > cb)
if(ptr[offset6] > cb)
goto is_a_corner;
else
if(ptr[offset11] > cb)
if(ptr[offset12] > cb)
if(ptr[offset13] > cb)
if(ptr[offset14] > cb)
if(ptr[offset15] > cb)
goto is_a_corner;
else
goto is_not_a_corner;
else
goto is_not_a_corner;
else
goto is_not_a_corner;
else
goto is_not_a_corner;
else
goto is_not_a_corner;
else
goto is_not_a_corner;
else
goto is_not_a_corner;
else
goto is_not_a_corner;
else
if(ptr[offset10] > cb)
if(ptr[offset11] > cb)
if(ptr[offset12] > cb)
if(ptr[offset8] > cb)
if(ptr[offset9] > cb)
if(ptr[offset6] > cb)
goto is_a_corner;
else
if(ptr[offset13] > cb)
if(ptr[offset14] > cb)
if(ptr[offset15] > cb)
goto is_a_corner;
else
goto is_not_a_corner;
else
goto is_not_a_corner;
else
goto is_not_a_corner;
else
if(ptr[offset1] > cb)
if(ptr[offset13] > cb)
if(ptr
opencv4.5.0编译x86 32位
需积分: 0 136 浏览量
更新于2023-03-20
2
收藏 512.74MB RAR 举报
OpenCV(开源计算机视觉库)是一个强大的跨平台计算机视觉库,它包含了大量的图像处理和计算机视觉算法,广泛应用于机器学习、图像分析、机器人等领域。在本案例中,我们讨论的是OpenCV 4.5.0版本针对x86架构32位系统的编译。
编译OpenCV通常是一个复杂的过程,涉及多个步骤,包括安装依赖库、配置编译选项、执行编译和链接等。对于x86 32位系统,这个过程可能更具挑战性,因为一些现代库可能不再支持或优化这个平台。然而,提供预编译的OpenCV库可以极大地简化这个过程,使得开发者能够快速地在32位环境中使用OpenCV功能。
OpenCV 4.5.0版本引入了多项新特性与改进,例如:
1. 支持最新的深度学习框架:OpenCV 4.5.0增强了对TensorFlow、PyTorch等深度学习框架的接口,使得用户能更方便地将模型集成到OpenCV应用中。
2. 更新的图像处理模块:包括更快的图像滤波器、颜色空间转换、边缘检测算法等,提高了处理速度和准确性。
3. 更强的视频分析能力:新增了多种视频分析算法,如对象检测、跟踪、人脸识别等,有助于开发复杂的视频处理应用。
4. 改进的CUDA支持:对于配备NVIDIA GPU的系统,OpenCV 4.5.0提供了更好的CUDA加速,使得计算密集型任务的性能得到显著提升。
5. 强大的机器学习库:OpenCV集成了机器学习库如MLP(多层感知机)、SVM(支持向量机)、决策树等,便于构建分类和回归模型。
在使用这个预编译的OpenCV 4.5.0版本时,你需要确保你的开发环境是32位的,并且满足所有必要的依赖项。这些依赖通常包括但不限于:Boost、Qt、IPPICV、CUDA(如果需要GPU支持)等。一旦你解压了压缩包,你可以通过包含头文件和链接库文件来在你的项目中使用OpenCV。
在C++项目中,这可能看起来像这样:
```cpp
#include <opencv2/opencv.hpp>
int main() {
cv::Mat image = cv::imread("image.jpg");
// ... 进行图像处理操作
return 0;
}
```
编译时,确保链接到正确的OpenCV库路径。例如,如果你的库位于`/path/to/opencv4.5.0/lib`,编译命令可能如下:
```bash
g++ main.cpp -I/path/to/opencv4.5.0/include -L/path/to/opencv4.5.0/lib -lopencv_core -lopencv_imgcodecs -o my_app
```
总结来说,预编译的OpenCV 4.5.0 for x86 32位系统是一个宝贵的资源,它消除了手动编译的复杂性,让开发者能够专注于他们的核心任务——利用OpenCV的强大功能来解决实际的计算机视觉问题。无论你是新手还是经验丰富的开发者,这个预编译版本都能让你更轻松地在32位环境中进行计算机视觉开发。
遗忘的背篓elous
- 粉丝: 4
- 资源: 1
最新资源
- 基于Revel,Jquery, Xorm开发的内容管理系统详细文档+优秀项目+全部资料.zip
- 基于websocket单台机器支持百万连接分布式聊天(IM)系统详细文档+优秀项目+全部资料.zip
- 基于原生Fabric-SDK-Go 实现一个简单的学历征信系统(web项目),状态数据库使用 CouchDB 来实现详细文档+优秀项目+全部资料.zip
- 基于开源CDN系统GoEdge制作的模版UI、插件、脚本合集详细文档+优秀项目+全部资料.zip
- 2022机器人SLAM知识星球答疑手册
- DSP28335 PMSM电机控制程序
- DSP28335 BLDC电机控制程序
- MiniBalance PC上位机开发资料
- 中大型三相异步电机电磁设计软件
- PLSQL程序设计Word文档doc格式最新版本
- 一、MySQL的介绍与安装
- 25个团队建设小游戏.ppt
- 管理团队拓展游戏.doc
- 几个经典团队游戏.doc
- 企业团队建设游戏活动经典收藏.doc
- 十个团队建设游戏.ppt