# Arc Adjacency Matrix based Fast Ellipse Detection
We proposed a fast ellipse detection method based on arc adjacency matrix. We have successfully used this method in some applications, such as satellite tracking, UGV guidance and pose estimation.
<div align="center">
<img src="measuretool/aamed.jpg" width="900px" />
</div>
:blush:**The binaries for Matlab and Python can be downloaded from the latest release.**
## 1 Compile our Codes
We have successfully applied AAMED to various platforms (Windows, Ubuntu, ARM). The codes used for different platforms may require some minor changes.
### 1.1 Windows
- OpenCV > 3.1.0
- VS 2015
You can add all .h and .cpp files into your project. Don't forget to config your project about OpenCV :).
main.cpp has given an example to detect ellipses from an image.
**AAMED aamed(drows, dcols)**. drows (dcols) must be larger than the rows (cols) of all used images. Then, we can use **aamed.run_FLED(imgG);** to detect ellipses from multiple images.
**Very important: Please check rows and cols of your input images are smaller than drows and dcols separately, otherwise, there will be some errors at class NODE_FC**
### 1.2 Ubuntu
We use **CMake** to generate *Makefile*, then use make to compile our method. This way is only used for Ubuntu, not suitable for Windows.
cd AAMED/cmake-build
cmake ..
make
./AAMED
### 1.3 Python
For Python, the OpenCV and NumPy packages are required.
**Building**
With the Anaconda distribution of Python (Windows and Linux) and the standard
Python in Linux, building the library can be done in the following way:
```
cd python
python setup.py build_ext --inplace
```
Once built, the created library (Windows: `.pyd`, Linux: `.so`) can be placed
anywhere.
If you are building on Windows without Anaconda, you must install OpenCV
manually alongside the OpenCV Python package. (Make sure the versions are the
same!) Then, in the `setup.py` file, the `opencv_root` variable should be set
to the specified OpenCV installation location. Once this is done, you can
continue to use the same commands above to build.
Note: for Windows without Anaconda, the `opencv_world` DLL should be
together with the `.pyd` as well. Alternatively, if you do not want to copy
the `opencv_world` DLL around, you can add the OpenCV bin location as a DLL
directory at the beginning of your script. For example:
```py
import os
os.add_dll_directory("D:/opencv/build/x64/vc14/bin")
```
**Testing**
To quickly test, `test_aamed.py` is provided.
```
python test_aamed.py
```
### 1.4 MATLAB
We have packaged AAMED, it can be used in MATLAB. AAMED needs OpenCV support. Note that if `mexdestoryaamed(obj) `is not called, the memory used in AAMED will remain in MATLAB all the time. Only restart matlab can clear the memory.
**Install**
You need to config OpenCV include path and library path in `setup.m` firstly. Then, you can run `setup.m` to compile **mexAAMED, mexdestoryAAMED, mexdetectImagebyAAMED, mexSetAAMEDParameters**.
**Test**
`test_aamed.m` provides an example to detect ellipses from an image.
obj = mexAAMED(540, 960); % AAMED only needs to be defined once
mexSetAAMEDParameters(obj, pi/3, 3.4, 0.77); % Set the parameters.
% This function can be used multiple times to detect ellipses from images
detElps = mexdetectImagebyAAMED(obj, img);
mexdestoryAAMED(obj); %Free memory (very important).
## 2 Label Tool
we provide a tool to label ellipses (circles) from an image. This tool is based on MATLAB R2016. First, you need to run `setup.m` to compile **mexElliFit**. Then, you can run `main.m` to use this label tool.
<div align="center">
<img src="labeltool/gui.jpg" width="600px" />
</div>
## 3 AAMED Viewer
we proivide a tool to show critical data (edge contours, DP contours, arc contours, AAM and detected ellipses) in MATLAB. We use this tool to find bugs of AAMED and test functions.
You need to run `setup.m` to compile **mexcvtBasicData, mexcvtRRect, mexcvtVVP, mexcvtAAM**. Then you can use `main.m` to read `DetailAAMED.aamed`.
<div align="center">
<img src="viewer/res.jpg" width="900px" />
</div>
## 4 Nine Datasets
We have uploaded 9 datasets used in our paper to [Baidu Cloud (Code: 7br2)](https://pan.baidu.com/s/1vUx7d3mvRxIPGSwi8DLADg) and [Google Drive](https://drive.google.com/file/d/1Af32acr4g9-4EvbAVMHS7fKVnD-XrDeM/view?usp=sharing).
## 5 Measure Tool
We have provided a tool that can be used to measure our method. Firstly, you need to run `setup.m` in *measuretool/MeasureTools* to build the mex files. Then, `MeasureAllDatasets.m` needs to be configured as described below. Finally, you can run `MeasureAllDatasets.m` to measure the used method.
- **data_root_path**: The root path of all datasets.
- **dataset_name**: The file names of used datasets. *dataset_name* is an array of *cell*, each element in it is a string that represents the dataset file name.
- **gt_label** contains the labels of corresponding datasets. `Read_Ellipse_GT.m` uses these labels to load ground-truth.
- **methods_name** is the file name that stores the results of used method.
- **method_label** is the label of corresponding method. `Read_Ellipse_Results.m` uses this label to load detection results.
The sample output of `MeasureAllDatasets.m` is as following.
Evaluating dataset: Satellite Images - Dataset Meng #2
Precision: 80.9524%, Recall: 85%, F-measure: 82.9268%.
Average detected time: 2.6065 ms.
## 6 How to Make your Datasets
The format of ellipse dataset is as follows.
<div align="center">
<img src="measuretool/dsformat.jpg" width="400px" />
</div>
If you want to make a new dataset, you can put the collected images into the file **images**. Then, the ground-truth files that are generated by labeltool can be put into the file **gt**. Finally, you need to create the file **imagenames.txt** that contains all image names.
If you have any questions, please contact me (lizhaoxi@buaa.edu.cn) or create an issue.
没有合适的资源?快使用搜索试试~ 我知道了~
基于弧邻接矩阵的快速椭圆检测_C++_Python_下载.zip
共84个文件
cpp:34个
m:23个
h:8个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 174 浏览量
2023-04-13
23:51:45
上传
评论
收藏 959KB ZIP 举报
温馨提示
基于弧邻接矩阵的快速椭圆检测_C++_Python_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于弧邻接矩阵的快速椭圆检测_C++_Python_下载.zip (84个子文件)
AAMED-master
CMakeLists.txt 431B
viewer
GenerateElpData.m 483B
main.m 3KB
DetailAAMED.aamed 808KB
res.jpg 69KB
mexcvtVVP.cpp 1KB
mexcvtRRect.cpp 1KB
setup.m 100B
mexcvtBasicData.cpp 1KB
mexcvtAAM.cpp 890B
cmake-build
002_0038.jpg 10KB
.gitattributes 21B
src
adaptApproxPolyDP.cpp 3KB
adaptApproximateContours.cpp 3KB
LinkMatrix.cpp 114B
FLED_Initialization.cpp 1KB
adaptApproximateContours.h 264B
LinkMatrix.h 970B
definition.h 1KB
Node_FC.cpp 921B
Validation.cpp 23KB
EllipseNonMaximumSuppression.h 315B
main.cpp 504B
FLED.h 16KB
FLED_PrivateFunctions.cpp 5KB
Segmentation.cpp 5KB
FLED_drawAndWriteFunctions.cpp 10KB
EllipseConstraint.h 2KB
Contours.cpp 4KB
FLED.cpp 29KB
Node_FC.h 2KB
Group.cpp 13KB
EllipseNonMaximumSuppression.cpp 6KB
LICENSE 18KB
matlab
139_0018.jpg 67KB
plot_aamed_res.m 251B
GenerateElpData.m 483B
mexdetectImagebyAAMED.cpp 2KB
mexSetAAMEDParameters.cpp 857B
mexdestoryAAMED.cpp 934B
test_aamed.m 556B
result.png 250KB
setup.m 1KB
mexAAMED.cpp 1KB
labeltool
GenerateElpData.m 483B
main.m 10KB
main_cn.fig 40KB
callback_keyboard_pression_fun.m 88B
main_label.m 620B
mexElliFit.cpp 6KB
main.fig 40KB
test_ellifit.m 131B
setup.m 258B
mexFitCircle.cpp 6KB
gui.jpg 61KB
main_cn.m 10KB
python
pyAAMED.pyx 2KB
setup.py 4KB
002_0038.jpg 10KB
test_aamed.py 267B
measuretool
aamed.jpg 237KB
dsformat.jpg 11KB
Read_Ellipse_GT.m 5KB
MeasureTools
CalculateRangeAtY.cpp 568B
mexCalculateRangeAtY.cpp 764B
CalculateRangeAtY.m 518B
CalculateOverlap.m 2KB
fasterCalculateOverlap.cpp 2KB
CalculateOverlap.cpp 2KB
mexELPShape2Equation.cpp 625B
ELPShape2Equation.cpp 984B
mexCalculateOverlap.cpp 1KB
CalculateRangeOfY.cpp 683B
ELPShape2Equation.m 737B
fasterCalculateOverlap.m 2KB
mexfasterCalculateOverlap.cpp 1KB
setup.m 2KB
CalculateRangeOfY.m 396B
MeasureTools.h 675B
mexCalculateRangeOfY.cpp 799B
MeasureAllDatasets.m 4KB
Read_Ellipse_Results.m 10KB
.gitignore 147B
README.md 6KB
共 84 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功