|
1 |
| -# ellipsedetect |
2 |
| - |
3 |
| -An Efficient High-quality Ellipse Detection. |
4 |
| - |
5 |
| -## references |
6 |
| - |
7 |
| -paper : https://arxiv.org/pdf/1810.03243v4.pdf |
8 |
| - |
9 |
| -code : https://github.com/AlanLuSun/High-quality-ellipse-detection |
10 |
| - |
11 |
| -## USAGE |
| 1 | +# 介绍 |
| 2 | +由于业界没有好的椭圆检测算法,所以我写一个库用来做椭圆检测。这个库对于图像中的标准、明显、完整、大小在 100x100 像素以上的椭圆的检测效果非常好,速度也很快。 |
| 3 | +这个库的实现参考了论文 ttps://arxiv.org/pdf/1810.03243v4.pdf。 |
12 | 4 |
|
| 5 | +# ubuntu 的使用方法 |
| 6 | +1. 首先需要安装两个库的支持,opencv 库,这个可以搜一下网上的教程安装一下。第二个库是一个矩阵运算的库lapack,需要源码安装。 |
| 7 | +先下载[lapack源码](https://github.com/Reference-LAPACK/lapack/archive/v3.9.0.tar.gz),这个库是gfortran写的,所以要先`sudo apt-get install gfortran`安装gfortran。 |
| 8 | +然后 |
13 | 9 | ```
|
14 |
| -cd ellipsedetect |
15 |
| -
|
| 10 | +tar -xzvf lapack-3.9.0.tar.gz && cd lapack-3.9.0 |
16 | 11 | mkdir build && cd build
|
| 12 | +cmake .. |
| 13 | +make -j7 |
| 14 | +sudo make install |
| 15 | +sudo ldconfig |
| 16 | +sudo cp sudo cp LAPACKE/include/*.h /usr/local/include/ |
| 17 | +``` |
17 | 18 |
|
| 19 | +2. 安装ellipse-detection库 |
| 20 | +``` |
| 21 | +git clone https://github.com/memory-overflow/standard-ellipse-detection.git |
| 22 | +cd standard-ellipse-detection |
| 23 | +mkdir build && cd build |
18 | 24 | cmake ..
|
| 25 | +make |
| 26 | +sudo make install |
| 27 | +``` |
19 | 28 |
|
| 29 | +3. 测试 |
| 30 | +提供了1个测试工具,可以查看算法效果。 |
| 31 | +``` |
| 32 | +cmake .. -DBUILD_TESTING=ON |
20 | 33 | make
|
| 34 | +./bin/testdetect [image_dir1] [image_dir2] [image_dir3] ... |
| 35 | +``` |
| 36 | + |
| 37 | +4. 接口和使用方法 |
| 38 | +代码中引用头文件`#include "ellipse_detection/detect.h"`,接口说明 |
| 39 | +``` |
| 40 | +bool detectEllipse(const uint8_t *image, int height, int width, |
| 41 | + std::vector<std::shared_ptr<Ellipse> > &ells, |
| 42 | + int polarity = 0, double line_width = 2.0); |
| 43 | +``` |
| 44 | +- 输入: |
| 45 | + - image 图像原始数据,按照"BRG"排列 |
| 46 | + - height 图像高度 |
| 47 | + - width 图像宽度 |
| 48 | + - polarity 表示椭圆极,默认为 0。 |
| 49 | + - line_width 椭圆线宽 |
| 50 | +- 输出 |
| 51 | + - ells 检测到的椭圆列表 |
21 | 52 |
|
22 |
| -make install |
| 53 | +关于 Ellipse 结构的说明 |
| 54 | +``` |
| 55 | +Pointd o; // 椭圆中心点 |
| 56 | +double a, b; // 短半轴线,长半轴长度 |
| 57 | +double phi; // 偏角,单位为弧度 |
| 58 | +int polarity; // 极性 |
| 59 | +double goodness; // 椭圆评分 |
| 60 | +double coverangle; // 椭圆角度完整程度 |
| 61 | +std::vector<Pixel> inliers; |
23 | 62 | ```
|
| 63 | + |
| 64 | +# 效果图 |
| 65 | +[图1](https://github.com/memory-overflow/standard-ellipse-detection/blob/master/images/test12_result.jpg) |
| 66 | + |
| 67 | +[图2](https://github.com/memory-overflow/standard-ellipse-detection/blob/master/images/test6_result.jpg) |
| 68 | + |
| 69 | +[图3](https://github.com/memory-overflow/standard-ellipse-detection/blob/master/images/test9_result.jpg) |
0 commit comments