mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-12 16:00:25 +08:00
Compare commits
196 Commits
release.al
...
release.be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87b3cb5c66 | ||
|
|
4293e61aa9 | ||
|
|
7f1ca6610e | ||
|
|
aef0e89de0 | ||
|
|
ae4f2bf08b | ||
|
|
62c523b6a1 | ||
|
|
0567c203ae | ||
|
|
9c163b7bd3 | ||
|
|
3a58f79f67 | ||
|
|
11ef392677 | ||
|
|
c89f2777d0 | ||
|
|
0b2c4fa410 | ||
|
|
81483cc594 | ||
|
|
ef201c9338 | ||
|
|
6fc7a9815e | ||
|
|
8e7b5baabd | ||
|
|
bf7675ad66 | ||
|
|
e2333696ed | ||
|
|
3b87ba0d59 | ||
|
|
5e10406849 | ||
|
|
edcd68274e | ||
|
|
e20b427ce8 | ||
|
|
c30f32c6b6 | ||
|
|
4dda5ae185 | ||
|
|
3016054a0a | ||
|
|
bfb4362fd2 | ||
|
|
3f2658970f | ||
|
|
3854b059f0 | ||
|
|
354e431054 | ||
|
|
3e9513adbd | ||
|
|
2b97fd26ac | ||
|
|
b15bc0502c | ||
|
|
ba91e81eef | ||
|
|
17bb6b4b07 | ||
|
|
3d9dad8e07 | ||
|
|
924f383dac | ||
|
|
5be7671e55 | ||
|
|
96856786e1 | ||
|
|
b6398357c7 | ||
|
|
5f6be6ea5b | ||
|
|
3244511831 | ||
|
|
c40a384b84 | ||
|
|
7756917150 | ||
|
|
a9ae7a674e | ||
|
|
e759623aba | ||
|
|
4799dfd477 | ||
|
|
233b3c31c4 | ||
|
|
c6f0c9f52a | ||
|
|
fa5eb93463 | ||
|
|
d6fb554d71 | ||
|
|
bce5fa0740 | ||
|
|
9c3df883ef | ||
|
|
f2d36824f5 | ||
|
|
d27637d439 | ||
|
|
98b5fcad55 | ||
|
|
1dc5830b2e | ||
|
|
804d7d83b0 | ||
|
|
c33c86c5a7 | ||
|
|
707c32f477 | ||
|
|
0ab487d6cd | ||
|
|
2ada30fae0 | ||
|
|
a626d69d76 | ||
|
|
33f9d8d73f | ||
|
|
7d80db3c63 | ||
|
|
47df3959e4 | ||
|
|
c2d628f944 | ||
|
|
9171399ea4 | ||
|
|
776f7e316c | ||
|
|
b00b3d2077 | ||
|
|
73a82a889a | ||
|
|
2c78538955 | ||
|
|
f5cf750013 | ||
|
|
1e8f255866 | ||
|
|
c155040e01 | ||
|
|
0afda9211d | ||
|
|
1fdde9a89f | ||
|
|
a32e625826 | ||
|
|
20ed4c8ea6 | ||
|
|
309abf6916 | ||
|
|
37ae306091 | ||
|
|
bf71156d78 | ||
|
|
044392c560 | ||
|
|
b924211b00 | ||
|
|
29c622e0be | ||
|
|
d9ddff0166 | ||
|
|
40823886de | ||
|
|
89d9915dc8 | ||
|
|
6811b963d9 | ||
|
|
d844e49ded | ||
|
|
a1168f8b40 | ||
|
|
b0e378c1d0 | ||
|
|
112a733bca | ||
|
|
7dbe5933c5 | ||
|
|
05b7b5c4f0 | ||
|
|
7dbe2f99f1 | ||
|
|
f9bfe0b444 | ||
|
|
28c4d4ad37 | ||
|
|
a521088057 | ||
|
|
f8521c2183 | ||
|
|
d6edce4190 | ||
|
|
453dc3004a | ||
|
|
af8634876a | ||
|
|
343eb875ec | ||
|
|
3be4eee85b | ||
|
|
d3fa659413 | ||
|
|
4a199c1ad4 | ||
|
|
2c41ee0998 | ||
|
|
72166acda0 | ||
|
|
bf8a4f7e93 | ||
|
|
a4a8b0cfb0 | ||
|
|
d6868e9439 | ||
|
|
d2165c0454 | ||
|
|
03b3bc2fff | ||
|
|
5c47ee0d82 | ||
|
|
2af89dfed6 | ||
|
|
9d15b33b50 | ||
|
|
c9fe6ed7e8 | ||
|
|
ed64fdf9dc | ||
|
|
fb2ea08787 | ||
|
|
3e0e7e29ec | ||
|
|
c1f0feca45 | ||
|
|
5b08671fae | ||
|
|
3020ca5d55 | ||
|
|
2171b630e1 | ||
|
|
97d9d8b15e | ||
|
|
186f5c3b3f | ||
|
|
0e1a6afc89 | ||
|
|
1690532cce | ||
|
|
4042062d8b | ||
|
|
77f50194cd | ||
|
|
ea39cd7132 | ||
|
|
53c5d2fdad | ||
|
|
245f5fec32 | ||
|
|
c7986fee91 | ||
|
|
d95a04aba5 | ||
|
|
0fbf23946f | ||
|
|
39fe244308 | ||
|
|
d5824fb72a | ||
|
|
334d41ff07 | ||
|
|
d6db919239 | ||
|
|
50c85554cb | ||
|
|
cd6183a397 | ||
|
|
046b5c3ee0 | ||
|
|
52280e491f | ||
|
|
3dfdb5be73 | ||
|
|
f399144fe8 | ||
|
|
19fbe943f4 | ||
|
|
d39c2e0e91 | ||
|
|
517f574ebc | ||
|
|
d594980744 | ||
|
|
5cc0e37a09 | ||
|
|
3a223f07c6 | ||
|
|
567f3cb16c | ||
|
|
aa6aeffeb0 | ||
|
|
d3f53792c5 | ||
|
|
a7939b80da | ||
|
|
3137a25257 | ||
|
|
9a53202577 | ||
|
|
429f55e06a | ||
|
|
44ada3bde8 | ||
|
|
1006abdcb7 | ||
|
|
8bd97ece0a | ||
|
|
03f3948d7d | ||
|
|
15dc26d5ef | ||
|
|
accf8c058f | ||
|
|
85da4589c2 | ||
|
|
980746dd87 | ||
|
|
bcf1de51e2 | ||
|
|
eb0a38f478 | ||
|
|
37e50b3708 | ||
|
|
6f31f041b8 | ||
|
|
c6e0f15690 | ||
|
|
bc0a10b852 | ||
|
|
9559843519 | ||
|
|
de96c97360 | ||
|
|
dab01fbafd | ||
|
|
345bcfec21 | ||
|
|
919bf0ab53 | ||
|
|
e086a49bdb | ||
|
|
e20156294e | ||
|
|
fea0602ef3 | ||
|
|
74476a0691 | ||
|
|
ad26562f12 | ||
|
|
168e2d3f63 | ||
|
|
49adab8665 | ||
|
|
2b1444d3c6 | ||
|
|
68346c009d | ||
|
|
850e9db0d3 | ||
|
|
9d43909fba | ||
|
|
ef29380dde | ||
|
|
23b7d3ae66 | ||
|
|
a0206f1d67 | ||
|
|
a312a61ae8 | ||
|
|
04e688b85c | ||
|
|
155f7bc79a | ||
|
|
11ef2934ad |
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1,2 +0,0 @@
|
||||
*.dll filter=lfs diff=lfs merge=lfs -text
|
||||
*.lib filter=lfs diff=lfs merge=lfs -text
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -425,3 +425,6 @@ FodyWeavers.xsd
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
screen.png
|
||||
adb_screen.png
|
||||
0
.gitmodules
vendored
0
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:32b8b36100090e37d2a892783ef9922fd890767d0546400ed737bf2d57698dfd
|
||||
size 4745216
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3efb02b69038309da6adc09ed9b4688c966cf88871d433a49687c3840aba9343
|
||||
size 55650816
|
||||
@@ -1,37 +0,0 @@
|
||||
#ifndef __OCR_ANGLENET_H__
|
||||
#define __OCR_ANGLENET_H__
|
||||
|
||||
#include "OcrStruct.h"
|
||||
#include <opencv/cv.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace ocr {
|
||||
class AngleNet {
|
||||
public:
|
||||
|
||||
~AngleNet();
|
||||
|
||||
void setNumThread(int numOfThread);
|
||||
|
||||
void setGpuIndex(int gpuIndex);
|
||||
|
||||
bool initModel(const std::string& pathStr);
|
||||
|
||||
std::vector<Angle> getAngles(std::vector<cv::Mat>& partImgs, const char* path,
|
||||
const char* imgName, bool doAngle, bool mostAngle);
|
||||
|
||||
private:
|
||||
bool isOutputAngleImg = false;
|
||||
int numThread;
|
||||
std::shared_ptr<ncnn::Net> pNet = std::make_shared<ncnn::Net>();
|
||||
const float meanValues[3] = { 127.5, 127.5, 127.5 };
|
||||
const float normValues[3] = { 1.0 / 127.5, 1.0 / 127.5, 1.0 / 127.5 };
|
||||
|
||||
const int dstWidth = 192;
|
||||
const int dstHeight = 32;
|
||||
|
||||
Angle getAngle(cv::Mat& src);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //__OCR_ANGLENET_H__
|
||||
@@ -1,39 +0,0 @@
|
||||
#ifndef __OCR_CRNNNET_H__
|
||||
#define __OCR_CRNNNET_H__
|
||||
|
||||
#include "OcrStruct.h"
|
||||
#include <opencv/cv.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace ocr {
|
||||
class CrnnNet {
|
||||
public:
|
||||
|
||||
~CrnnNet();
|
||||
|
||||
void setNumThread(int numOfThread);
|
||||
|
||||
void setGpuIndex(int gpuIndex);
|
||||
|
||||
bool initModel(const std::string& pathStr, const std::string& keysPath);
|
||||
|
||||
std::vector<TextLine> getTextLines(std::vector<cv::Mat>& partImg, const char* path, const char* imgName);
|
||||
|
||||
private:
|
||||
bool isOutputDebugImg = false;
|
||||
int numThread;
|
||||
std::shared_ptr<ncnn::Net> pNet = std::make_shared<ncnn::Net>();
|
||||
|
||||
const float meanValues[3] = { 127.5, 127.5, 127.5 };
|
||||
const float normValues[3] = { 1.0 / 127.5, 1.0 / 127.5, 1.0 / 127.5 };
|
||||
const int dstHeight = 32;
|
||||
|
||||
std::vector<std::string> keys;
|
||||
|
||||
TextLine scoreToTextLine(const std::vector<float>& outputData, int h, int w);
|
||||
|
||||
TextLine getTextLine(const cv::Mat& src);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //__OCR_CRNNNET_H__
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef __OCR_DBNET_H__
|
||||
#define __OCR_DBNET_H__
|
||||
|
||||
#include "OcrStruct.h"
|
||||
#include <opencv/cv.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace ocr {
|
||||
class DbNet {
|
||||
public:
|
||||
~DbNet();
|
||||
|
||||
void setNumThread(int numOfThread);
|
||||
|
||||
void setGpuIndex(int gpuIndex);
|
||||
|
||||
bool initModel(const std::string& pathStr);
|
||||
|
||||
std::vector<TextBox> getTextBoxes(cv::Mat& src, ScaleParam& s, float boxScoreThresh,
|
||||
float boxThresh, float unClipRatio);
|
||||
|
||||
private:
|
||||
int numThread;
|
||||
std::shared_ptr<ncnn::Net> pNet = std::make_shared<ncnn::Net>();
|
||||
const float meanValues[3] = { 0.485 * 255, 0.456 * 255, 0.406 * 255 };
|
||||
const float normValues[3] = { 1.0 / 0.229 / 255.0, 1.0 / 0.224 / 255.0, 1.0 / 0.225 / 255.0 };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //__OCR_DBNET_H__
|
||||
@@ -1,75 +0,0 @@
|
||||
#ifndef __OCR_LITE_H__
|
||||
#define __OCR_LITE_H__
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include "OcrStruct.h"
|
||||
#include "DbNet.h"
|
||||
#include "AngleNet.h"
|
||||
#include "CrnnNet.h"
|
||||
|
||||
namespace ocr {
|
||||
class OCRLITE_EXPORT OcrLite {
|
||||
public:
|
||||
OcrLite();
|
||||
|
||||
~OcrLite();
|
||||
|
||||
void setNumThread(int numOfThread);
|
||||
|
||||
void initLogger(bool isConsole, bool isPartImg, bool isResultImg);
|
||||
|
||||
void enableResultTxt(const char* path, const char* imgName);
|
||||
|
||||
void setGpuIndex(int gpuIndex);
|
||||
|
||||
bool initModels(const std::string& detPath, const std::string& clsPath,
|
||||
const std::string& recPath, const std::string& keysPath);
|
||||
|
||||
void Logger(const char* format, ...);
|
||||
|
||||
/*
|
||||
* padding:图像预处理,在图片外周添加白边,用于提升识别率,文字框没有正确框住所有文字时,增加此值。
|
||||
* maxSideLen :按图片最长边的长度,此值为0代表不缩放,例:1024,如果图片长边大于1024则把图像整体缩小到1024再进行图像分割计算,如果图片长边小于1024则不缩放,如果图片长边小于32,则缩放到32。
|
||||
* boxScoreThresh:文字框置信度门限,文字框没有正确框住所有文字时,减小此值。
|
||||
* boxThresh:请自行试验。
|
||||
* unClipRatio:单个文字框大小倍率,越大时单个文字框越大。此项与图片的大小相关,越大的图片此值应该越大。
|
||||
* doAngle:启用(1)/禁用(0) 文字方向检测,只有图片倒置的情况下(旋转90~270度的图片),才需要启用文字方向检测。
|
||||
* mostAngle:启用(1)/禁用(0) 角度投票(整张图片以最大可能文字方向来识别),当禁用文字方向检测时,此项也不起作用。
|
||||
*/
|
||||
OcrResult detect(const char* path, const char* imgName,
|
||||
int padding, int maxSideLen,
|
||||
float boxScoreThresh, float boxThresh, float unClipRatio, bool doAngle, bool mostAngle);
|
||||
|
||||
/*
|
||||
* padding:图像预处理,在图片外周添加白边,用于提升识别率,文字框没有正确框住所有文字时,增加此值。
|
||||
* maxSideLen :按图片最长边的长度,此值为0代表不缩放,例:1024,如果图片长边大于1024则把图像整体缩小到1024再进行图像分割计算,如果图片长边小于1024则不缩放,如果图片长边小于32,则缩放到32。
|
||||
* boxScoreThresh:文字框置信度门限,文字框没有正确框住所有文字时,减小此值。
|
||||
* boxThresh:请自行试验。
|
||||
* unClipRatio:单个文字框大小倍率,越大时单个文字框越大。此项与图片的大小相关,越大的图片此值应该越大。
|
||||
* doAngle:启用(1)/禁用(0) 文字方向检测,只有图片倒置的情况下(旋转90~270度的图片),才需要启用文字方向检测。
|
||||
* mostAngle:启用(1)/禁用(0) 角度投票(整张图片以最大可能文字方向来识别),当禁用文字方向检测时,此项也不起作用。
|
||||
*/
|
||||
OcrResult detect(const cv::Mat& mat,
|
||||
int padding, int maxSideLen,
|
||||
float boxScoreThresh, float boxThresh, float unClipRatio, bool doAngle, bool mostAngle);
|
||||
private:
|
||||
bool isOutputConsole = false;
|
||||
bool isOutputPartImg = false;
|
||||
bool isOutputResultTxt = false;
|
||||
bool isOutputResultImg = false;
|
||||
FILE* resultTxt;
|
||||
DbNet dbNet;
|
||||
AngleNet angleNet;
|
||||
CrnnNet crnnNet;
|
||||
|
||||
std::vector<cv::Mat> getPartImages(cv::Mat& src, std::vector<TextBox>& textBoxes,
|
||||
const char* path, const char* imgName);
|
||||
|
||||
OcrResult detect(const char* path, const char* imgName,
|
||||
cv::Mat& src, cv::Rect& originRect, ScaleParam& scale,
|
||||
float boxScoreThresh = 0.6f, float boxThresh = 0.3f,
|
||||
float unClipRatio = 2.0f, bool doAngle = true, bool mostAngle = true);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //__OCR_LITE_H__
|
||||
@@ -1,65 +0,0 @@
|
||||
#ifndef __OCR_STRUCT_H__
|
||||
#define __OCR_STRUCT_H__
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include <vector>
|
||||
|
||||
#ifdef __C_API__
|
||||
#define OCRLITE_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define OCRLITE_EXPORT
|
||||
#endif
|
||||
|
||||
namespace ncnn {
|
||||
class Net;
|
||||
}
|
||||
|
||||
namespace ocr {
|
||||
struct OCRLITE_EXPORT ScaleParam {
|
||||
int srcWidth;
|
||||
int srcHeight;
|
||||
int dstWidth;
|
||||
int dstHeight;
|
||||
float ratioWidth;
|
||||
float ratioHeight;
|
||||
};
|
||||
|
||||
struct OCRLITE_EXPORT TextBox {
|
||||
std::vector<cv::Point> boxPoint;
|
||||
float score;
|
||||
};
|
||||
|
||||
struct OCRLITE_EXPORT Angle {
|
||||
int index;
|
||||
float score;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct OCRLITE_EXPORT TextLine {
|
||||
std::string text;
|
||||
std::vector<float> charScores;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct OCRLITE_EXPORT TextBlock {
|
||||
std::vector<cv::Point> boxPoint;
|
||||
float boxScore;
|
||||
int angleIndex;
|
||||
float angleScore;
|
||||
double angleTime;
|
||||
std::string text;
|
||||
std::vector<float> charScores;
|
||||
double crnnTime;
|
||||
double blockTime;
|
||||
};
|
||||
|
||||
struct OCRLITE_EXPORT OcrResult {
|
||||
double dbNetTime;
|
||||
std::vector<TextBlock> textBlocks;
|
||||
cv::Mat boxImg;
|
||||
double detectTime;
|
||||
std::string strRes;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //__OCR_STRUCT_H__
|
||||
@@ -1,66 +0,0 @@
|
||||
#ifndef __OCR_UTILS_H__
|
||||
#define __OCR_UTILS_H__
|
||||
|
||||
#include <opencv2/core.hpp>
|
||||
#include "OcrStruct.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
/*#define __ENABLE_CONSOLE__ true
|
||||
#define Logger(format, ...) {\
|
||||
if(__ENABLE_CONSOLE__) printf(format,##__VA_ARGS__); \
|
||||
}*/
|
||||
|
||||
namespace ocr {
|
||||
OCRLITE_EXPORT double getCurrentTime();
|
||||
|
||||
OCRLITE_EXPORT inline bool isFileExists(const std::string& name) {
|
||||
struct stat buffer;
|
||||
return (stat(name.c_str(), &buffer) == 0);
|
||||
}
|
||||
|
||||
OCRLITE_EXPORT std::wstring strToWstr(std::string str);
|
||||
|
||||
OCRLITE_EXPORT ScaleParam getScaleParam(cv::Mat& src, const float scale);
|
||||
|
||||
OCRLITE_EXPORT ScaleParam getScaleParam(cv::Mat& src, const int targetSize);
|
||||
|
||||
OCRLITE_EXPORT std::vector<cv::Point2f> getBox(const cv::RotatedRect& rect);
|
||||
|
||||
OCRLITE_EXPORT int getThickness(cv::Mat& boxImg);
|
||||
|
||||
OCRLITE_EXPORT void drawTextBox(cv::Mat& boxImg, cv::RotatedRect& rect, int thickness);
|
||||
|
||||
OCRLITE_EXPORT void drawTextBox(cv::Mat& boxImg, const std::vector<cv::Point>& box, int thickness);
|
||||
|
||||
OCRLITE_EXPORT void drawTextBoxes(cv::Mat& boxImg, std::vector<TextBox>& textBoxes, int thickness);
|
||||
|
||||
OCRLITE_EXPORT cv::Mat matRotateClockWise180(cv::Mat src);
|
||||
|
||||
OCRLITE_EXPORT cv::Mat matRotateClockWise90(cv::Mat src);
|
||||
|
||||
OCRLITE_EXPORT cv::Mat getRotateCropImage(const cv::Mat& src, std::vector<cv::Point> box);
|
||||
|
||||
OCRLITE_EXPORT cv::Mat adjustTargetImg(cv::Mat& src, int dstWidth, int dstHeight);
|
||||
|
||||
OCRLITE_EXPORT std::vector<cv::Point> getMinBoxes(const std::vector<cv::Point>& inVec, float& minSideLen, float& allEdgeSize);
|
||||
|
||||
OCRLITE_EXPORT float boxScoreFast(const cv::Mat& inMat, const std::vector<cv::Point>& inBox);
|
||||
|
||||
OCRLITE_EXPORT std::vector<cv::Point> unClip(const std::vector<cv::Point>& inBox, float perimeter, float unClipRatio);
|
||||
|
||||
OCRLITE_EXPORT std::vector<int> getAngleIndexes(std::vector<Angle>& angles);
|
||||
|
||||
OCRLITE_EXPORT void saveImg(cv::Mat& img, const char* imgPath);
|
||||
|
||||
OCRLITE_EXPORT std::string getSrcImgFilePath(const char* path, const char* imgName);
|
||||
|
||||
OCRLITE_EXPORT std::string getResultTxtFilePath(const char* path, const char* imgName);
|
||||
|
||||
OCRLITE_EXPORT std::string getResultImgFilePath(const char* path, const char* imgName);
|
||||
|
||||
OCRLITE_EXPORT std::string getDebugImgFilePath(const char* path, const char* imgName, int i, const char* tag);
|
||||
|
||||
OCRLITE_EXPORT void printGpuInfo();
|
||||
}
|
||||
|
||||
#endif //__OCR_UTILS_H__
|
||||
@@ -1,27 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
namespace json
|
||||
{
|
||||
class exception : public std::exception
|
||||
{
|
||||
public:
|
||||
exception() = default;
|
||||
exception(const std::string &msg);
|
||||
|
||||
exception(const exception &) = default;
|
||||
exception &operator=(const exception &) = default;
|
||||
exception(exception &&) = default;
|
||||
exception &operator=(exception &&) = default;
|
||||
|
||||
virtual ~exception() noexcept override = default;
|
||||
|
||||
virtual const char *what() const noexcept override;
|
||||
|
||||
private:
|
||||
std::string m_msg;
|
||||
};
|
||||
|
||||
} // namespace json
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* ** File generated automatically, do not modify **
|
||||
*
|
||||
* This file defines the list of modules available in current build configuration
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
// This definition means that OpenCV is built with enabled non-free code.
|
||||
// For example, patented algorithms for non-profit/non-commercial use only.
|
||||
/* #undef OPENCV_ENABLE_NONFREE */
|
||||
|
||||
#define HAVE_OPENCV_CALIB3D
|
||||
#define HAVE_OPENCV_CORE
|
||||
#define HAVE_OPENCV_DNN
|
||||
#define HAVE_OPENCV_FEATURES2D
|
||||
#define HAVE_OPENCV_FLANN
|
||||
#define HAVE_OPENCV_HIGHGUI
|
||||
#define HAVE_OPENCV_IMGCODECS
|
||||
#define HAVE_OPENCV_IMGPROC
|
||||
#define HAVE_OPENCV_ML
|
||||
#define HAVE_OPENCV_OBJDETECT
|
||||
#define HAVE_OPENCV_PHOTO
|
||||
#define HAVE_OPENCV_SHAPE
|
||||
#define HAVE_OPENCV_STITCHING
|
||||
#define HAVE_OPENCV_SUPERRES
|
||||
#define HAVE_OPENCV_VIDEO
|
||||
#define HAVE_OPENCV_VIDEOIO
|
||||
#define HAVE_OPENCV_VIDEOSTAB
|
||||
#define HAVE_OPENCV_WORLD
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5cc75be243439729d3faca7b20e9c0fe0e4b8d6139fffbbb05383735f54136af
|
||||
size 27804
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ce622e0ee7151279d492776a768946324a4739cb4810d5b77aae4daa413a945c
|
||||
size 4833204
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:673035c2d9da9fd08b6912fa23c7d06388f310818730f95ef8d953f8f271529a
|
||||
size 2467276
|
||||
Binary file not shown.
@@ -1,111 +0,0 @@
|
||||
7767517
|
||||
109 125
|
||||
Input input 0 1 input
|
||||
Convolution 339 1 1 input 341 0=24 1=3 3=2 4=1 5=1 6=648 9=1
|
||||
Pooling 342 1 1 341 342 1=3 2=2 12=1 3=1 5=1
|
||||
Split splitncnn_0 1 2 342 342_splitncnn_0 342_splitncnn_1
|
||||
ConvolutionDepthWise 343 1 1 342_splitncnn_1 343 0=24 1=3 3=2 4=1 5=1 6=216 7=24
|
||||
Convolution 345 1 1 343 347 0=24 1=1 5=1 6=576 9=1
|
||||
Convolution 348 1 1 342_splitncnn_0 350 0=24 1=1 5=1 6=576 9=1
|
||||
ConvolutionDepthWise 351 1 1 350 351 0=24 1=3 3=2 4=1 5=1 6=216 7=24
|
||||
Convolution 353 1 1 351 355 0=24 1=1 5=1 6=576 9=1
|
||||
Concat 356 2 1 347 355 356
|
||||
ShuffleChannel 361 1 1 356 361 0=2
|
||||
Slice 362 1 2 361 362 363 -23300=2,24,-233
|
||||
Convolution 364 1 1 363 366 0=24 1=1 5=1 6=576 9=1
|
||||
ConvolutionDepthWise 367 1 1 366 367 0=24 1=3 4=1 5=1 6=216 7=24
|
||||
Convolution 369 1 1 367 371 0=24 1=1 5=1 6=576 9=1
|
||||
Concat 372 2 1 362 371 372
|
||||
ShuffleChannel 377 1 1 372 377 0=2
|
||||
Slice 378 1 2 377 378 379 -23300=2,24,-233
|
||||
Convolution 380 1 1 379 382 0=24 1=1 5=1 6=576 9=1
|
||||
ConvolutionDepthWise 383 1 1 382 383 0=24 1=3 4=1 5=1 6=216 7=24
|
||||
Convolution 385 1 1 383 387 0=24 1=1 5=1 6=576 9=1
|
||||
Concat 388 2 1 378 387 388
|
||||
ShuffleChannel 393 1 1 388 393 0=2
|
||||
Slice 394 1 2 393 394 395 -23300=2,24,-233
|
||||
Convolution 396 1 1 395 398 0=24 1=1 5=1 6=576 9=1
|
||||
ConvolutionDepthWise 399 1 1 398 399 0=24 1=3 4=1 5=1 6=216 7=24
|
||||
Convolution 401 1 1 399 403 0=24 1=1 5=1 6=576 9=1
|
||||
Concat 404 2 1 394 403 404
|
||||
ShuffleChannel 409 1 1 404 409 0=2
|
||||
Split splitncnn_1 1 2 409 409_splitncnn_0 409_splitncnn_1
|
||||
ConvolutionDepthWise 410 1 1 409_splitncnn_1 410 0=48 1=3 3=2 4=1 5=1 6=432 7=48
|
||||
Convolution 412 1 1 410 414 0=48 1=1 5=1 6=2304 9=1
|
||||
Convolution 415 1 1 409_splitncnn_0 417 0=48 1=1 5=1 6=2304 9=1
|
||||
ConvolutionDepthWise 418 1 1 417 418 0=48 1=3 3=2 4=1 5=1 6=432 7=48
|
||||
Convolution 420 1 1 418 422 0=48 1=1 5=1 6=2304 9=1
|
||||
Concat 423 2 1 414 422 423
|
||||
ShuffleChannel 428 1 1 423 428 0=2
|
||||
Slice 429 1 2 428 429 430 -23300=2,48,-233
|
||||
Convolution 431 1 1 430 433 0=48 1=1 5=1 6=2304 9=1
|
||||
ConvolutionDepthWise 434 1 1 433 434 0=48 1=3 4=1 5=1 6=432 7=48
|
||||
Convolution 436 1 1 434 438 0=48 1=1 5=1 6=2304 9=1
|
||||
Concat 439 2 1 429 438 439
|
||||
ShuffleChannel 444 1 1 439 444 0=2
|
||||
Slice 445 1 2 444 445 446 -23300=2,48,-233
|
||||
Convolution 447 1 1 446 449 0=48 1=1 5=1 6=2304 9=1
|
||||
ConvolutionDepthWise 450 1 1 449 450 0=48 1=3 4=1 5=1 6=432 7=48
|
||||
Convolution 452 1 1 450 454 0=48 1=1 5=1 6=2304 9=1
|
||||
Concat 455 2 1 445 454 455
|
||||
ShuffleChannel 460 1 1 455 460 0=2
|
||||
Slice 461 1 2 460 461 462 -23300=2,48,-233
|
||||
Convolution 463 1 1 462 465 0=48 1=1 5=1 6=2304 9=1
|
||||
ConvolutionDepthWise 466 1 1 465 466 0=48 1=3 4=1 5=1 6=432 7=48
|
||||
Convolution 468 1 1 466 470 0=48 1=1 5=1 6=2304 9=1
|
||||
Concat 471 2 1 461 470 471
|
||||
ShuffleChannel 476 1 1 471 476 0=2
|
||||
Slice 477 1 2 476 477 478 -23300=2,48,-233
|
||||
Convolution 479 1 1 478 481 0=48 1=1 5=1 6=2304 9=1
|
||||
ConvolutionDepthWise 482 1 1 481 482 0=48 1=3 4=1 5=1 6=432 7=48
|
||||
Convolution 484 1 1 482 486 0=48 1=1 5=1 6=2304 9=1
|
||||
Concat 487 2 1 477 486 487
|
||||
ShuffleChannel 492 1 1 487 492 0=2
|
||||
Slice 493 1 2 492 493 494 -23300=2,48,-233
|
||||
Convolution 495 1 1 494 497 0=48 1=1 5=1 6=2304 9=1
|
||||
ConvolutionDepthWise 498 1 1 497 498 0=48 1=3 4=1 5=1 6=432 7=48
|
||||
Convolution 500 1 1 498 502 0=48 1=1 5=1 6=2304 9=1
|
||||
Concat 503 2 1 493 502 503
|
||||
ShuffleChannel 508 1 1 503 508 0=2
|
||||
Slice 509 1 2 508 509 510 -23300=2,48,-233
|
||||
Convolution 511 1 1 510 513 0=48 1=1 5=1 6=2304 9=1
|
||||
ConvolutionDepthWise 514 1 1 513 514 0=48 1=3 4=1 5=1 6=432 7=48
|
||||
Convolution 516 1 1 514 518 0=48 1=1 5=1 6=2304 9=1
|
||||
Concat 519 2 1 509 518 519
|
||||
ShuffleChannel 524 1 1 519 524 0=2
|
||||
Slice 525 1 2 524 525 526 -23300=2,48,-233
|
||||
Convolution 527 1 1 526 529 0=48 1=1 5=1 6=2304 9=1
|
||||
ConvolutionDepthWise 530 1 1 529 530 0=48 1=3 4=1 5=1 6=432 7=48
|
||||
Convolution 532 1 1 530 534 0=48 1=1 5=1 6=2304 9=1
|
||||
Concat 535 2 1 525 534 535
|
||||
ShuffleChannel 540 1 1 535 540 0=2
|
||||
Split splitncnn_2 1 2 540 540_splitncnn_0 540_splitncnn_1
|
||||
ConvolutionDepthWise 541 1 1 540_splitncnn_1 541 0=96 1=3 3=2 4=1 5=1 6=864 7=96
|
||||
Convolution 543 1 1 541 545 0=96 1=1 5=1 6=9216 9=1
|
||||
Convolution 546 1 1 540_splitncnn_0 548 0=96 1=1 5=1 6=9216 9=1
|
||||
ConvolutionDepthWise 549 1 1 548 549 0=96 1=3 3=2 4=1 5=1 6=864 7=96
|
||||
Convolution 551 1 1 549 553 0=96 1=1 5=1 6=9216 9=1
|
||||
Concat 554 2 1 545 553 554
|
||||
ShuffleChannel 559 1 1 554 559 0=2
|
||||
Slice 560 1 2 559 560 561 -23300=2,96,-233
|
||||
Convolution 562 1 1 561 564 0=96 1=1 5=1 6=9216 9=1
|
||||
ConvolutionDepthWise 565 1 1 564 565 0=96 1=3 4=1 5=1 6=864 7=96
|
||||
Convolution 567 1 1 565 569 0=96 1=1 5=1 6=9216 9=1
|
||||
Concat 570 2 1 560 569 570
|
||||
ShuffleChannel 575 1 1 570 575 0=2
|
||||
Slice 576 1 2 575 576 577 -23300=2,96,-233
|
||||
Convolution 578 1 1 577 580 0=96 1=1 5=1 6=9216 9=1
|
||||
ConvolutionDepthWise 581 1 1 580 581 0=96 1=3 4=1 5=1 6=864 7=96
|
||||
Convolution 583 1 1 581 585 0=96 1=1 5=1 6=9216 9=1
|
||||
Concat 586 2 1 576 585 586
|
||||
ShuffleChannel 591 1 1 586 591 0=2
|
||||
Slice 592 1 2 591 592 593 -23300=2,96,-233
|
||||
Convolution 594 1 1 593 596 0=96 1=1 5=1 6=9216 9=1
|
||||
ConvolutionDepthWise 597 1 1 596 597 0=96 1=3 4=1 5=1 6=864 7=96
|
||||
Convolution 599 1 1 597 601 0=96 1=1 5=1 6=9216 9=1
|
||||
Concat 602 2 1 592 601 602
|
||||
ShuffleChannel 607 1 1 602 607 0=2
|
||||
Convolution 608 1 1 607 610 0=256 1=1 5=1 6=49152 9=1
|
||||
Reduction 611 1 1 610 611 0=3 1=0 -23303=2,2,3
|
||||
InnerProduct 612 1 1 611 612 0=2 1=1 2=512
|
||||
Softmax out 1 1 612 out
|
||||
Binary file not shown.
@@ -1,203 +0,0 @@
|
||||
7767517
|
||||
201 244
|
||||
Input input 0 1 input
|
||||
Convolution 423 1 1 input 425 0=8 1=3 3=2 4=1 5=1 6=216 9=1
|
||||
Split splitncnn_0 1 2 425 425_splitncnn_0 425_splitncnn_1
|
||||
Convolution 426 1 1 425_splitncnn_1 428 0=4 1=1 5=1 6=32 9=1
|
||||
Split splitncnn_1 1 2 428 428_splitncnn_0 428_splitncnn_1
|
||||
ConvolutionDepthWise 429 1 1 428_splitncnn_1 431 0=4 1=3 4=1 5=1 6=36 7=4 9=1
|
||||
Concat 432 2 1 428_splitncnn_0 431 432
|
||||
ConvolutionDepthWise 433 1 1 432 433 0=8 1=3 13=2 4=1 5=1 6=72 7=8
|
||||
Split splitncnn_2 1 2 433 433_splitncnn_0 433_splitncnn_1
|
||||
Pooling 441 1 1 433_splitncnn_1 445 0=1 4=1
|
||||
InnerProduct 446 1 1 445 447 0=2 1=1 2=16 9=1
|
||||
InnerProduct 448 1 1 447 448 0=8 1=1 2=16
|
||||
Reshape 456 1 1 448 456 0=1 1=1 2=8
|
||||
Clip 457 1 1 456 457 0=0.000000e+00 1=1.000000e+00
|
||||
BinaryOp 458 2 1 433_splitncnn_0 457 458 0=2
|
||||
Convolution 459 1 1 458 459 0=4 1=1 5=1 6=32
|
||||
Split splitncnn_3 1 2 459 459_splitncnn_0 459_splitncnn_1
|
||||
ConvolutionDepthWise 461 1 1 459_splitncnn_1 461 0=4 1=3 4=1 5=1 6=36 7=4
|
||||
Concat 463 2 1 459_splitncnn_0 461 463
|
||||
ConvolutionDepthWise 464 1 1 425_splitncnn_0 466 0=8 1=3 13=2 4=1 5=1 6=72 7=8 9=1
|
||||
Convolution 467 1 1 466 467 0=8 1=1 5=1 6=64
|
||||
BinaryOp 469 2 1 463 467 469
|
||||
Split splitncnn_4 1 2 469 469_splitncnn_0 469_splitncnn_1
|
||||
Convolution 470 1 1 469_splitncnn_1 472 0=28 1=1 5=1 6=224 9=1
|
||||
Split splitncnn_5 1 2 472 472_splitncnn_0 472_splitncnn_1
|
||||
ConvolutionDepthWise 473 1 1 472_splitncnn_1 475 0=28 1=3 4=1 5=1 6=252 7=28 9=1
|
||||
Concat 476 2 1 472_splitncnn_0 475 476
|
||||
ConvolutionDepthWise 477 1 1 476 477 0=56 1=3 13=2 4=1 5=1 6=504 7=56
|
||||
Convolution 479 1 1 477 479 0=6 1=1 5=1 6=336
|
||||
Split splitncnn_6 1 2 479 479_splitncnn_0 479_splitncnn_1
|
||||
ConvolutionDepthWise 481 1 1 479_splitncnn_1 481 0=6 1=3 4=1 5=1 6=54 7=6
|
||||
Concat 483 2 1 479_splitncnn_0 481 483
|
||||
ConvolutionDepthWise 484 1 1 469_splitncnn_0 486 0=8 1=3 13=2 4=1 5=1 6=72 7=8 9=1
|
||||
Convolution 487 1 1 486 487 0=12 1=1 5=1 6=96
|
||||
BinaryOp 489 2 1 483 487 489
|
||||
Split splitncnn_7 1 2 489 489_splitncnn_0 489_splitncnn_1
|
||||
Convolution 490 1 1 489_splitncnn_1 492 0=22 1=1 5=1 6=264 9=1
|
||||
Split splitncnn_8 1 2 492 492_splitncnn_0 492_splitncnn_1
|
||||
ConvolutionDepthWise 493 1 1 492_splitncnn_1 495 0=22 1=3 4=1 5=1 6=198 7=22 9=1
|
||||
Concat 496 2 1 492_splitncnn_0 495 496
|
||||
Convolution 497 1 1 496 497 0=6 1=1 5=1 6=264
|
||||
Split splitncnn_9 1 2 497 497_splitncnn_0 497_splitncnn_1
|
||||
ConvolutionDepthWise 499 1 1 497_splitncnn_1 499 0=6 1=3 4=1 5=1 6=54 7=6
|
||||
Concat 501 2 1 497_splitncnn_0 499 501
|
||||
BinaryOp 502 2 1 501 489_splitncnn_0 502
|
||||
Split splitncnn_10 1 2 502 502_splitncnn_0 502_splitncnn_1
|
||||
Convolution 503 1 1 502_splitncnn_1 505 0=40 1=1 5=1 6=480 9=1
|
||||
Split splitncnn_11 1 2 505 505_splitncnn_0 505_splitncnn_1
|
||||
ConvolutionDepthWise 506 1 1 505_splitncnn_1 508 0=40 1=3 4=1 5=1 6=360 7=40 9=1
|
||||
Concat 509 2 1 505_splitncnn_0 508 509
|
||||
ConvolutionDepthWise 510 1 1 509 510 0=80 1=5 13=2 4=2 5=1 6=2000 7=80
|
||||
Split splitncnn_12 1 2 510 510_splitncnn_0 510_splitncnn_1
|
||||
Pooling 518 1 1 510_splitncnn_1 522 0=1 4=1
|
||||
InnerProduct 523 1 1 522 524 0=20 1=1 2=1600 9=1
|
||||
InnerProduct 525 1 1 524 525 0=80 1=1 2=1600
|
||||
Reshape 533 1 1 525 533 0=1 1=1 2=80
|
||||
Clip 534 1 1 533 534 0=0.000000e+00 1=1.000000e+00
|
||||
BinaryOp 535 2 1 510_splitncnn_0 534 535 0=2
|
||||
Convolution 536 1 1 535 536 0=10 1=1 5=1 6=800
|
||||
Split splitncnn_13 1 2 536 536_splitncnn_0 536_splitncnn_1
|
||||
ConvolutionDepthWise 538 1 1 536_splitncnn_1 538 0=10 1=3 4=1 5=1 6=90 7=10
|
||||
Concat 540 2 1 536_splitncnn_0 538 540
|
||||
ConvolutionDepthWise 541 1 1 502_splitncnn_0 543 0=12 1=3 13=2 4=1 5=1 6=108 7=12 9=1
|
||||
Convolution 544 1 1 543 544 0=20 1=1 5=1 6=240
|
||||
BinaryOp 546 2 1 540 544 546
|
||||
Split splitncnn_14 1 2 546 546_splitncnn_0 546_splitncnn_1
|
||||
Convolution 547 1 1 546_splitncnn_1 549 0=60 1=1 5=1 6=1200 9=1
|
||||
Split splitncnn_15 1 2 549 549_splitncnn_0 549_splitncnn_1
|
||||
ConvolutionDepthWise 550 1 1 549_splitncnn_1 552 0=60 1=3 4=1 5=1 6=540 7=60 9=1
|
||||
Concat 553 2 1 549_splitncnn_0 552 553
|
||||
Split splitncnn_16 1 2 553 553_splitncnn_0 553_splitncnn_1
|
||||
Pooling 560 1 1 553_splitncnn_1 564 0=1 4=1
|
||||
InnerProduct 565 1 1 564 566 0=30 1=1 2=3600 9=1
|
||||
InnerProduct 567 1 1 566 567 0=120 1=1 2=3600
|
||||
Reshape 575 1 1 567 575 0=1 1=1 2=120
|
||||
Clip 576 1 1 575 576 0=0.000000e+00 1=1.000000e+00
|
||||
BinaryOp 577 2 1 553_splitncnn_0 576 577 0=2
|
||||
Convolution 578 1 1 577 578 0=10 1=1 5=1 6=1200
|
||||
Split splitncnn_17 1 2 578 578_splitncnn_0 578_splitncnn_1
|
||||
ConvolutionDepthWise 580 1 1 578_splitncnn_1 580 0=10 1=3 4=1 5=1 6=90 7=10
|
||||
Concat 582 2 1 578_splitncnn_0 580 582
|
||||
BinaryOp 583 2 1 582 546_splitncnn_0 583
|
||||
Split splitncnn_18 1 2 583 583_splitncnn_0 583_splitncnn_1
|
||||
Convolution 584 1 1 583_splitncnn_1 586 0=60 1=1 5=1 6=1200 9=1
|
||||
Split splitncnn_19 1 2 586 586_splitncnn_0 586_splitncnn_1
|
||||
ConvolutionDepthWise 587 1 1 586_splitncnn_1 589 0=60 1=3 4=1 5=1 6=540 7=60 9=1
|
||||
Concat 590 2 1 586_splitncnn_0 589 590
|
||||
Split splitncnn_20 1 2 590 590_splitncnn_0 590_splitncnn_1
|
||||
Pooling 597 1 1 590_splitncnn_1 601 0=1 4=1
|
||||
InnerProduct 602 1 1 601 603 0=30 1=1 2=3600 9=1
|
||||
InnerProduct 604 1 1 603 604 0=120 1=1 2=3600
|
||||
Reshape 612 1 1 604 612 0=1 1=1 2=120
|
||||
Clip 613 1 1 612 613 0=0.000000e+00 1=1.000000e+00
|
||||
BinaryOp 614 2 1 590_splitncnn_0 613 614 0=2
|
||||
Convolution 615 1 1 614 615 0=10 1=1 5=1 6=1200
|
||||
Split splitncnn_21 1 2 615 615_splitncnn_0 615_splitncnn_1
|
||||
ConvolutionDepthWise 617 1 1 615_splitncnn_1 617 0=10 1=3 4=1 5=1 6=90 7=10
|
||||
Concat 619 2 1 615_splitncnn_0 617 619
|
||||
BinaryOp 620 2 1 619 583_splitncnn_0 620
|
||||
Split splitncnn_22 1 2 620 620_splitncnn_0 620_splitncnn_1
|
||||
Convolution 621 1 1 620_splitncnn_1 623 0=36 1=1 5=1 6=720 9=1
|
||||
Split splitncnn_23 1 2 623 623_splitncnn_0 623_splitncnn_1
|
||||
ConvolutionDepthWise 624 1 1 623_splitncnn_1 626 0=36 1=3 4=1 5=1 6=324 7=36 9=1
|
||||
Concat 627 2 1 623_splitncnn_0 626 627
|
||||
Split splitncnn_24 1 2 627 627_splitncnn_0 627_splitncnn_1
|
||||
Pooling 634 1 1 627_splitncnn_1 638 0=1 4=1
|
||||
InnerProduct 639 1 1 638 640 0=18 1=1 2=1296 9=1
|
||||
InnerProduct 641 1 1 640 641 0=72 1=1 2=1296
|
||||
Reshape 649 1 1 641 649 0=1 1=1 2=72
|
||||
Clip 650 1 1 649 650 0=0.000000e+00 1=1.000000e+00
|
||||
BinaryOp 651 2 1 627_splitncnn_0 650 651 0=2
|
||||
Convolution 652 1 1 651 652 0=12 1=1 5=1 6=864
|
||||
Split splitncnn_25 1 2 652 652_splitncnn_0 652_splitncnn_1
|
||||
ConvolutionDepthWise 654 1 1 652_splitncnn_1 654 0=12 1=3 4=1 5=1 6=108 7=12
|
||||
Concat 656 2 1 652_splitncnn_0 654 656
|
||||
ConvolutionDepthWise 657 1 1 620_splitncnn_0 659 0=20 1=3 4=1 5=1 6=180 7=20 9=1
|
||||
Convolution 660 1 1 659 660 0=24 1=1 5=1 6=480
|
||||
BinaryOp 662 2 1 656 660 662
|
||||
Split splitncnn_26 1 2 662 662_splitncnn_0 662_splitncnn_1
|
||||
Convolution 663 1 1 662_splitncnn_1 665 0=36 1=1 5=1 6=864 9=1
|
||||
Split splitncnn_27 1 2 665 665_splitncnn_0 665_splitncnn_1
|
||||
ConvolutionDepthWise 666 1 1 665_splitncnn_1 668 0=36 1=3 4=1 5=1 6=324 7=36 9=1
|
||||
Concat 669 2 1 665_splitncnn_0 668 669
|
||||
Split splitncnn_28 1 2 669 669_splitncnn_0 669_splitncnn_1
|
||||
Pooling 676 1 1 669_splitncnn_1 680 0=1 4=1
|
||||
InnerProduct 681 1 1 680 682 0=18 1=1 2=1296 9=1
|
||||
InnerProduct 683 1 1 682 683 0=72 1=1 2=1296
|
||||
Reshape 691 1 1 683 691 0=1 1=1 2=72
|
||||
Clip 692 1 1 691 692 0=0.000000e+00 1=1.000000e+00
|
||||
BinaryOp 693 2 1 669_splitncnn_0 692 693 0=2
|
||||
Convolution 694 1 1 693 694 0=12 1=1 5=1 6=864
|
||||
Split splitncnn_29 1 2 694 694_splitncnn_0 694_splitncnn_1
|
||||
ConvolutionDepthWise 696 1 1 694_splitncnn_1 696 0=12 1=3 4=1 5=1 6=108 7=12
|
||||
Concat 698 2 1 694_splitncnn_0 696 698
|
||||
BinaryOp 699 2 1 698 662_splitncnn_0 699
|
||||
Split splitncnn_30 1 2 699 699_splitncnn_0 699_splitncnn_1
|
||||
Convolution 700 1 1 699_splitncnn_1 702 0=144 1=1 5=1 6=3456 9=1
|
||||
Split splitncnn_31 1 2 702 702_splitncnn_0 702_splitncnn_1
|
||||
ConvolutionDepthWise 703 1 1 702_splitncnn_1 705 0=144 1=3 4=1 5=1 6=1296 7=144 9=1
|
||||
Concat 706 2 1 702_splitncnn_0 705 706
|
||||
ConvolutionDepthWise 707 1 1 706 707 0=288 1=5 13=2 4=2 5=1 6=7200 7=288
|
||||
Split splitncnn_32 1 2 707 707_splitncnn_0 707_splitncnn_1
|
||||
Pooling 715 1 1 707_splitncnn_1 719 0=1 4=1
|
||||
InnerProduct 720 1 1 719 721 0=72 1=1 2=20736 9=1
|
||||
InnerProduct 722 1 1 721 722 0=288 1=1 2=20736
|
||||
Reshape 730 1 1 722 730 0=1 1=1 2=288
|
||||
Clip 731 1 1 730 731 0=0.000000e+00 1=1.000000e+00
|
||||
BinaryOp 732 2 1 707_splitncnn_0 731 732 0=2
|
||||
Convolution 733 1 1 732 733 0=24 1=1 5=1 6=6912
|
||||
Split splitncnn_33 1 2 733 733_splitncnn_0 733_splitncnn_1
|
||||
ConvolutionDepthWise 735 1 1 733_splitncnn_1 735 0=24 1=3 4=1 5=1 6=216 7=24
|
||||
Concat 737 2 1 733_splitncnn_0 735 737
|
||||
ConvolutionDepthWise 738 1 1 699_splitncnn_0 740 0=24 1=3 13=2 4=1 5=1 6=216 7=24 9=1
|
||||
Convolution 741 1 1 740 741 0=48 1=1 5=1 6=1152
|
||||
BinaryOp 743 2 1 737 741 743
|
||||
Split splitncnn_34 1 2 743 743_splitncnn_0 743_splitncnn_1
|
||||
Convolution 744 1 1 743_splitncnn_1 746 0=144 1=1 5=1 6=6912 9=1
|
||||
Split splitncnn_35 1 2 746 746_splitncnn_0 746_splitncnn_1
|
||||
ConvolutionDepthWise 747 1 1 746_splitncnn_1 749 0=144 1=3 4=1 5=1 6=1296 7=144 9=1
|
||||
Concat 750 2 1 746_splitncnn_0 749 750
|
||||
Split splitncnn_36 1 2 750 750_splitncnn_0 750_splitncnn_1
|
||||
Pooling 757 1 1 750_splitncnn_1 761 0=1 4=1
|
||||
InnerProduct 762 1 1 761 763 0=72 1=1 2=20736 9=1
|
||||
InnerProduct 764 1 1 763 764 0=288 1=1 2=20736
|
||||
Reshape 772 1 1 764 772 0=1 1=1 2=288
|
||||
Clip 773 1 1 772 773 0=0.000000e+00 1=1.000000e+00
|
||||
BinaryOp 774 2 1 750_splitncnn_0 773 774 0=2
|
||||
Convolution 775 1 1 774 775 0=24 1=1 5=1 6=6912
|
||||
Split splitncnn_37 1 2 775 775_splitncnn_0 775_splitncnn_1
|
||||
ConvolutionDepthWise 777 1 1 775_splitncnn_1 777 0=24 1=3 4=1 5=1 6=216 7=24
|
||||
Concat 779 2 1 775_splitncnn_0 777 779
|
||||
BinaryOp 780 2 1 779 743_splitncnn_0 780
|
||||
Split splitncnn_38 1 2 780 780_splitncnn_0 780_splitncnn_1
|
||||
Convolution 781 1 1 780_splitncnn_1 783 0=144 1=1 5=1 6=6912 9=1
|
||||
Split splitncnn_39 1 2 783 783_splitncnn_0 783_splitncnn_1
|
||||
ConvolutionDepthWise 784 1 1 783_splitncnn_1 786 0=144 1=3 4=1 5=1 6=1296 7=144 9=1
|
||||
Concat 787 2 1 783_splitncnn_0 786 787
|
||||
Split splitncnn_40 1 2 787 787_splitncnn_0 787_splitncnn_1
|
||||
Pooling 794 1 1 787_splitncnn_1 798 0=1 4=1
|
||||
InnerProduct 799 1 1 798 800 0=72 1=1 2=20736 9=1
|
||||
InnerProduct 801 1 1 800 801 0=288 1=1 2=20736
|
||||
Reshape 809 1 1 801 809 0=1 1=1 2=288
|
||||
Clip 810 1 1 809 810 0=0.000000e+00 1=1.000000e+00
|
||||
BinaryOp 811 2 1 787_splitncnn_0 810 811 0=2
|
||||
Convolution 812 1 1 811 812 0=24 1=1 5=1 6=6912
|
||||
Split splitncnn_41 1 2 812 812_splitncnn_0 812_splitncnn_1
|
||||
ConvolutionDepthWise 814 1 1 812_splitncnn_1 814 0=24 1=3 4=1 5=1 6=216 7=24
|
||||
Concat 816 2 1 812_splitncnn_0 814 816
|
||||
BinaryOp 817 2 1 816 780_splitncnn_0 817
|
||||
Convolution 818 1 1 817 820 0=288 1=1 5=1 6=13824 9=1
|
||||
Pooling 821 1 1 820 821 1=2 11=1 2=2 12=1 5=1
|
||||
Reshape 822 1 1 821 822 0=-1 1=288 2=-233
|
||||
Permute 823 1 1 822 823 0=1
|
||||
Split splitncnn_42 1 2 823 823_splitncnn_0 823_splitncnn_1
|
||||
LSTM 857 1 1 823_splitncnn_1 860 0=48 1=55296 2=0
|
||||
LSTM 883 1 1 860 886 0=48 1=9216 2=0
|
||||
LSTM 943 1 1 823_splitncnn_0 948 0=48 1=110592 2=2
|
||||
LSTM 994 1 1 948 999 0=48 1=36864 2=2
|
||||
Concat 1000 2 1 886 999 1000 0=1
|
||||
Reshape 1014 1 1 1000 1014 0=144 1=-1
|
||||
InnerProduct out 1 1 1014 out 0=5531 1=1 2=796464
|
||||
Binary file not shown.
@@ -1,144 +0,0 @@
|
||||
7767517
|
||||
142 163
|
||||
Input input0 0 1 input0
|
||||
Convolution 346 1 1 input0 346 0=16 1=3 3=2 4=1 5=1 6=432
|
||||
HardSwish 353 1 1 346 353 0=1.666667e-01
|
||||
Split splitncnn_0 1 2 353 353_splitncnn_0 353_splitncnn_1
|
||||
ConvolutionDepthWise 354 1 1 353_splitncnn_1 356 0=16 1=3 4=1 5=1 6=144 7=16 9=1
|
||||
Convolution 357 1 1 356 357 0=16 1=1 5=1 6=256
|
||||
BinaryOp 359 2 1 353_splitncnn_0 357 359
|
||||
Convolution 360 1 1 359 362 0=64 1=1 5=1 6=1024 9=1
|
||||
ConvolutionDepthWise 363 1 1 362 365 0=64 1=3 3=2 4=1 5=1 6=576 7=64 9=1
|
||||
Convolution 366 1 1 365 366 0=24 1=1 5=1 6=1536
|
||||
Split splitncnn_1 1 2 366 366_splitncnn_0 366_splitncnn_1
|
||||
Convolution 368 1 1 366_splitncnn_1 370 0=72 1=1 5=1 6=1728 9=1
|
||||
ConvolutionDepthWise 371 1 1 370 373 0=72 1=3 4=1 5=1 6=648 7=72 9=1
|
||||
Convolution 374 1 1 373 374 0=24 1=1 5=1 6=1728
|
||||
BinaryOp 376 2 1 366_splitncnn_0 374 376
|
||||
Split splitncnn_2 1 2 376 376_splitncnn_0 376_splitncnn_1
|
||||
Convolution 377 1 1 376_splitncnn_1 379 0=72 1=1 5=1 6=1728 9=1
|
||||
ConvolutionDepthWise 380 1 1 379 380 0=72 1=5 3=2 4=2 5=1 6=1800 7=72
|
||||
Split splitncnn_3 1 2 380 380_splitncnn_0 380_splitncnn_1
|
||||
Pooling 388 1 1 380_splitncnn_1 392 0=1 4=1
|
||||
InnerProduct 393 1 1 392 394 0=24 1=1 2=1728 9=1
|
||||
InnerProduct 395 1 1 394 395 0=72 1=1 2=1728
|
||||
HardSigmoid 400 1 1 395 400 0=1.666667e-01
|
||||
BinaryOp 409 2 1 380_splitncnn_0 400 409 0=2
|
||||
ReLU 410 1 1 409 410
|
||||
Convolution 411 1 1 410 411 0=32 1=1 5=1 6=2304
|
||||
Split splitncnn_4 1 2 411 411_splitncnn_0 411_splitncnn_1
|
||||
Convolution 413 1 1 411_splitncnn_1 415 0=96 1=1 5=1 6=3072 9=1
|
||||
ConvolutionDepthWise 416 1 1 415 416 0=96 1=5 4=2 5=1 6=2400 7=96
|
||||
Split splitncnn_5 1 2 416 416_splitncnn_0 416_splitncnn_1
|
||||
Pooling 424 1 1 416_splitncnn_1 428 0=1 4=1
|
||||
InnerProduct 429 1 1 428 430 0=24 1=1 2=2304 9=1
|
||||
InnerProduct 431 1 1 430 431 0=96 1=1 2=2304
|
||||
HardSigmoid 436 1 1 431 436 0=1.666667e-01
|
||||
BinaryOp 445 2 1 416_splitncnn_0 436 445 0=2
|
||||
ReLU 446 1 1 445 446
|
||||
Convolution 447 1 1 446 447 0=32 1=1 5=1 6=3072
|
||||
BinaryOp 449 2 1 411_splitncnn_0 447 449
|
||||
Split splitncnn_6 1 2 449 449_splitncnn_0 449_splitncnn_1
|
||||
Convolution 450 1 1 449_splitncnn_1 452 0=96 1=1 5=1 6=3072 9=1
|
||||
ConvolutionDepthWise 453 1 1 452 453 0=96 1=5 4=2 5=1 6=2400 7=96
|
||||
Split splitncnn_7 1 2 453 453_splitncnn_0 453_splitncnn_1
|
||||
Pooling 461 1 1 453_splitncnn_1 465 0=1 4=1
|
||||
InnerProduct 466 1 1 465 467 0=24 1=1 2=2304 9=1
|
||||
InnerProduct 468 1 1 467 468 0=96 1=1 2=2304
|
||||
HardSigmoid 473 1 1 468 473 0=1.666667e-01
|
||||
BinaryOp 482 2 1 453_splitncnn_0 473 482 0=2
|
||||
ReLU 483 1 1 482 483
|
||||
Convolution 484 1 1 483 484 0=32 1=1 5=1 6=3072
|
||||
BinaryOp 486 2 1 449_splitncnn_0 484 486
|
||||
Split splitncnn_8 1 2 486 486_splitncnn_0 486_splitncnn_1
|
||||
Convolution 487 1 1 486_splitncnn_1 487 0=192 1=1 5=1 6=6144
|
||||
HardSwish 494 1 1 487 494 0=1.666667e-01
|
||||
ConvolutionDepthWise 495 1 1 494 495 0=192 1=3 3=2 4=1 5=1 6=1728 7=192
|
||||
HardSwish 502 1 1 495 502 0=1.666667e-01
|
||||
Convolution 503 1 1 502 503 0=64 1=1 5=1 6=12288
|
||||
Split splitncnn_9 1 2 503 503_splitncnn_0 503_splitncnn_1
|
||||
Convolution 505 1 1 503_splitncnn_1 505 0=160 1=1 5=1 6=10240
|
||||
HardSwish 512 1 1 505 512 0=1.666667e-01
|
||||
ConvolutionDepthWise 513 1 1 512 513 0=160 1=3 4=1 5=1 6=1440 7=160
|
||||
HardSwish 520 1 1 513 520 0=1.666667e-01
|
||||
Convolution 521 1 1 520 521 0=64 1=1 5=1 6=10240
|
||||
BinaryOp 523 2 1 503_splitncnn_0 521 523
|
||||
Split splitncnn_10 1 2 523 523_splitncnn_0 523_splitncnn_1
|
||||
Convolution 524 1 1 523_splitncnn_1 524 0=144 1=1 5=1 6=9216
|
||||
HardSwish 531 1 1 524 531 0=1.666667e-01
|
||||
ConvolutionDepthWise 532 1 1 531 532 0=144 1=3 4=1 5=1 6=1296 7=144
|
||||
HardSwish 539 1 1 532 539 0=1.666667e-01
|
||||
Convolution 540 1 1 539 540 0=64 1=1 5=1 6=9216
|
||||
BinaryOp 542 2 1 523_splitncnn_0 540 542
|
||||
Split splitncnn_11 1 2 542 542_splitncnn_0 542_splitncnn_1
|
||||
Convolution 543 1 1 542_splitncnn_1 543 0=144 1=1 5=1 6=9216
|
||||
HardSwish 550 1 1 543 550 0=1.666667e-01
|
||||
ConvolutionDepthWise 551 1 1 550 551 0=144 1=3 4=1 5=1 6=1296 7=144
|
||||
HardSwish 558 1 1 551 558 0=1.666667e-01
|
||||
Convolution 559 1 1 558 559 0=64 1=1 5=1 6=9216
|
||||
BinaryOp 561 2 1 542_splitncnn_0 559 561
|
||||
Convolution 562 1 1 561 562 0=384 1=1 5=1 6=24576
|
||||
HardSwish 569 1 1 562 569 0=1.666667e-01
|
||||
ConvolutionDepthWise 570 1 1 569 570 0=384 1=3 4=1 5=1 6=3456 7=384
|
||||
Split splitncnn_12 1 2 570 570_splitncnn_0 570_splitncnn_1
|
||||
Pooling 578 1 1 570_splitncnn_1 582 0=1 4=1
|
||||
InnerProduct 583 1 1 582 584 0=96 1=1 2=36864 9=1
|
||||
InnerProduct 585 1 1 584 585 0=384 1=1 2=36864
|
||||
HardSigmoid 590 1 1 585 590 0=1.666667e-01
|
||||
BinaryOp 599 2 1 570_splitncnn_0 590 599 0=2
|
||||
HardSwish 605 1 1 599 605 0=1.666667e-01
|
||||
Convolution 606 1 1 605 606 0=88 1=1 5=1 6=33792
|
||||
Split splitncnn_13 1 2 606 606_splitncnn_0 606_splitncnn_1
|
||||
Convolution 608 1 1 606_splitncnn_1 608 0=528 1=1 5=1 6=46464
|
||||
HardSwish 615 1 1 608 615 0=1.666667e-01
|
||||
ConvolutionDepthWise 616 1 1 615 616 0=528 1=3 4=1 5=1 6=4752 7=528
|
||||
Split splitncnn_14 1 2 616 616_splitncnn_0 616_splitncnn_1
|
||||
Pooling 624 1 1 616_splitncnn_1 628 0=1 4=1
|
||||
InnerProduct 629 1 1 628 630 0=136 1=1 2=71808 9=1
|
||||
InnerProduct 631 1 1 630 631 0=528 1=1 2=71808
|
||||
HardSigmoid 636 1 1 631 636 0=1.666667e-01
|
||||
BinaryOp 645 2 1 616_splitncnn_0 636 645 0=2
|
||||
HardSwish 651 1 1 645 651 0=1.666667e-01
|
||||
Convolution 652 1 1 651 652 0=88 1=1 5=1 6=46464
|
||||
BinaryOp 654 2 1 606_splitncnn_0 652 654
|
||||
Split splitncnn_15 1 2 654 654_splitncnn_0 654_splitncnn_1
|
||||
Convolution 655 1 1 654_splitncnn_1 655 0=528 1=1 5=1 6=46464
|
||||
HardSwish 662 1 1 655 662 0=1.666667e-01
|
||||
ConvolutionDepthWise 663 1 1 662 663 0=528 1=5 3=2 4=2 5=1 6=13200 7=528
|
||||
Split splitncnn_16 1 2 663 663_splitncnn_0 663_splitncnn_1
|
||||
Pooling 671 1 1 663_splitncnn_1 675 0=1 4=1
|
||||
InnerProduct 676 1 1 675 677 0=136 1=1 2=71808 9=1
|
||||
InnerProduct 678 1 1 677 678 0=528 1=1 2=71808
|
||||
HardSigmoid 683 1 1 678 683 0=1.666667e-01
|
||||
BinaryOp 692 2 1 663_splitncnn_0 683 692 0=2
|
||||
HardSwish 698 1 1 692 698 0=1.666667e-01
|
||||
Convolution 699 1 1 698 699 0=120 1=1 5=1 6=63360
|
||||
Convolution 701 1 1 699 703 0=24 1=1 5=1 6=2880 9=1
|
||||
Split splitncnn_17 1 2 703 703_splitncnn_0 703_splitncnn_1
|
||||
Convolution 704 1 1 654_splitncnn_0 706 0=24 1=1 5=1 6=2112 9=1
|
||||
Interp 723 1 1 703_splitncnn_1 723 0=1 1=2.000000e+00 2=2.000000e+00
|
||||
BinaryOp 724 2 1 723 706 724
|
||||
Convolution 725 1 1 724 727 0=24 1=3 4=1 5=1 6=5184 9=1
|
||||
Split splitncnn_18 1 2 727 727_splitncnn_0 727_splitncnn_1
|
||||
Convolution 728 1 1 486_splitncnn_0 730 0=24 1=1 5=1 6=768 9=1
|
||||
Interp 747 1 1 727_splitncnn_1 747 0=1 1=2.000000e+00 2=2.000000e+00
|
||||
BinaryOp 748 2 1 747 730 748
|
||||
Convolution 749 1 1 748 751 0=24 1=3 4=1 5=1 6=5184 9=1
|
||||
Split splitncnn_19 1 2 751 751_splitncnn_0 751_splitncnn_1
|
||||
Convolution 752 1 1 376_splitncnn_0 754 0=24 1=1 5=1 6=576 9=1
|
||||
Interp 771 1 1 751_splitncnn_1 771 0=1 1=2.000000e+00 2=2.000000e+00
|
||||
BinaryOp 772 2 1 771 754 772
|
||||
Convolution 773 1 1 772 775 0=24 1=3 4=1 5=1 6=5184 9=1
|
||||
Interp 792 1 1 751_splitncnn_0 792 0=1 1=2.000000e+00 2=2.000000e+00
|
||||
Interp 803 1 1 727_splitncnn_0 803 0=1 1=4.000000e+00 2=4.000000e+00
|
||||
Interp 814 1 1 703_splitncnn_0 814 0=1 1=8.000000e+00 2=8.000000e+00
|
||||
Concat 815 4 1 775 792 803 814 815
|
||||
Convolution 816 1 1 815 818 0=96 1=3 4=1 5=1 6=82944 9=1
|
||||
Split splitncnn_20 1 2 818 818_splitncnn_0 818_splitncnn_1
|
||||
Convolution 819 1 1 818_splitncnn_1 821 0=24 1=3 4=1 5=1 6=20736 9=1
|
||||
Deconvolution 822 1 1 821 824 0=24 1=2 3=2 5=1 6=2304 9=1
|
||||
Deconvolution 825 1 1 824 826 0=1 1=2 3=2 5=1 6=96 9=4
|
||||
Convolution 827 1 1 818_splitncnn_0 829 0=24 1=3 4=1 5=1 6=20736 9=1
|
||||
Deconvolution 830 1 1 829 832 0=24 1=2 3=2 5=1 6=2304 9=1
|
||||
Deconvolution 833 1 1 832 834 0=1 1=2 3=2 5=1 6=96 9=4
|
||||
Concat out1 2 1 826 834 out1
|
||||
BIN
3rdparty/bin/OcrLiteOnnx.dll
vendored
Normal file
BIN
3rdparty/bin/OcrLiteOnnx.dll
vendored
Normal file
Binary file not shown.
BIN
3rdparty/bin/opencv_world3413.dll
vendored
Normal file
BIN
3rdparty/bin/opencv_world3413.dll
vendored
Normal file
Binary file not shown.
41
3rdparty/include/OcrLiteOnnx/AngleNet.h
vendored
Normal file
41
3rdparty/include/OcrLiteOnnx/AngleNet.h
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef __OCR_ANGLENET_H__
|
||||
#define __OCR_ANGLENET_H__
|
||||
|
||||
#include "OcrStruct.h"
|
||||
#include "onnxruntime_cxx_api.h"
|
||||
#include <opencv/cv.hpp>
|
||||
|
||||
class AngleNet {
|
||||
public:
|
||||
AngleNet();
|
||||
|
||||
~AngleNet();
|
||||
|
||||
void setNumThread(int numOfThread);
|
||||
|
||||
void initModel(const std::string &pathStr);
|
||||
|
||||
std::vector<Angle> getAngles(std::vector<cv::Mat> &partImgs, const char *path,
|
||||
const char *imgName, bool doAngle, bool mostAngle);
|
||||
|
||||
private:
|
||||
bool isOutputAngleImg = false;
|
||||
|
||||
Ort::Session *session;
|
||||
Ort::Env env = Ort::Env(ORT_LOGGING_LEVEL_ERROR, "AngleNet");
|
||||
Ort::SessionOptions sessionOptions = Ort::SessionOptions();
|
||||
int numThread = 0;
|
||||
|
||||
char *inputName;
|
||||
char *outputName;
|
||||
|
||||
const float meanValues[3] = {127.5, 127.5, 127.5};
|
||||
const float normValues[3] = {1.0 / 127.5, 1.0 / 127.5, 1.0 / 127.5};
|
||||
const int dstWidth = 192;
|
||||
const int dstHeight = 32;
|
||||
|
||||
Angle getAngle(cv::Mat &src);
|
||||
};
|
||||
|
||||
|
||||
#endif //__OCR_ANGLENET_H__
|
||||
43
3rdparty/include/OcrLiteOnnx/CrnnNet.h
vendored
Normal file
43
3rdparty/include/OcrLiteOnnx/CrnnNet.h
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef __OCR_CRNNNET_H__
|
||||
#define __OCR_CRNNNET_H__
|
||||
|
||||
#include "OcrStruct.h"
|
||||
#include "onnxruntime_cxx_api.h"
|
||||
#include <opencv/cv.hpp>
|
||||
|
||||
class CrnnNet {
|
||||
public:
|
||||
|
||||
CrnnNet();
|
||||
|
||||
~CrnnNet();
|
||||
|
||||
void setNumThread(int numOfThread);
|
||||
|
||||
void initModel(const std::string &pathStr, const std::string &keysPath);
|
||||
|
||||
std::vector<TextLine> getTextLines(std::vector<cv::Mat> &partImg, const char *path, const char *imgName);
|
||||
|
||||
private:
|
||||
bool isOutputDebugImg = false;
|
||||
Ort::Session *session;
|
||||
Ort::Env env = Ort::Env(ORT_LOGGING_LEVEL_ERROR, "CrnnNet");
|
||||
Ort::SessionOptions sessionOptions = Ort::SessionOptions();
|
||||
int numThread = 0;
|
||||
|
||||
char *inputName;
|
||||
char *outputName;
|
||||
|
||||
const float meanValues[3] = {127.5, 127.5, 127.5};
|
||||
const float normValues[3] = {1.0 / 127.5, 1.0 / 127.5, 1.0 / 127.5};
|
||||
const int dstHeight = 32;
|
||||
|
||||
std::vector<std::string> keys;
|
||||
|
||||
TextLine scoreToTextLine(const std::vector<float> &outputData, int h, int w);
|
||||
|
||||
TextLine getTextLine(const cv::Mat &src);
|
||||
};
|
||||
|
||||
|
||||
#endif //__OCR_CRNNNET_H__
|
||||
34
3rdparty/include/OcrLiteOnnx/DbNet.h
vendored
Normal file
34
3rdparty/include/OcrLiteOnnx/DbNet.h
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef __OCR_DBNET_H__
|
||||
#define __OCR_DBNET_H__
|
||||
|
||||
#include "OcrStruct.h"
|
||||
#include "onnxruntime_cxx_api.h"
|
||||
#include <opencv/cv.hpp>
|
||||
|
||||
class DbNet {
|
||||
public:
|
||||
DbNet();
|
||||
|
||||
~DbNet();
|
||||
|
||||
void setNumThread(int numOfThread);
|
||||
|
||||
void initModel(const std::string &pathStr);
|
||||
|
||||
std::vector<TextBox> getTextBoxes(cv::Mat &src, ScaleParam &s, float boxScoreThresh,
|
||||
float boxThresh, float unClipRatio);
|
||||
|
||||
private:
|
||||
Ort::Session *session;
|
||||
Ort::Env env = Ort::Env(ORT_LOGGING_LEVEL_ERROR, "DbNet");
|
||||
Ort::SessionOptions sessionOptions = Ort::SessionOptions();
|
||||
int numThread = 0;
|
||||
char *inputName;
|
||||
char *outputName;
|
||||
|
||||
const float meanValues[3] = {0.485 * 255, 0.456 * 255, 0.406 * 255};
|
||||
const float normValues[3] = {1.0 / 0.229 / 255.0, 1.0 / 0.224 / 255.0, 1.0 / 0.225 / 255.0};
|
||||
};
|
||||
|
||||
|
||||
#endif //__OCR_DBNET_H__
|
||||
56
3rdparty/include/OcrLiteOnnx/OcrLite.h
vendored
Normal file
56
3rdparty/include/OcrLiteOnnx/OcrLite.h
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef __OCR_LITE_H__
|
||||
#define __OCR_LITE_H__
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include "onnxruntime_cxx_api.h"
|
||||
#include "OcrStruct.h"
|
||||
#include "DbNet.h"
|
||||
#include "AngleNet.h"
|
||||
#include "CrnnNet.h"
|
||||
|
||||
class OcrLite {
|
||||
public:
|
||||
OcrLite();
|
||||
|
||||
~OcrLite();
|
||||
|
||||
void setNumThread(int numOfThread);
|
||||
|
||||
void initLogger(bool isConsole, bool isPartImg, bool isResultImg);
|
||||
|
||||
void enableResultTxt(const char *path, const char *imgName);
|
||||
|
||||
void initModels(const std::string &detPath, const std::string &clsPath,
|
||||
const std::string &recPath, const std::string &keysPath);
|
||||
|
||||
void Logger(const char *format, ...);
|
||||
|
||||
OcrResult detect(const char *path, const char *imgName,
|
||||
int padding, int maxSideLen,
|
||||
float boxScoreThresh, float boxThresh, float unClipRatio, bool doAngle, bool mostAngle);
|
||||
|
||||
|
||||
OcrResult detect(const cv::Mat& mat,
|
||||
int padding, int maxSideLen,
|
||||
float boxScoreThresh, float boxThresh, float unClipRatio, bool doAngle, bool mostAngle);
|
||||
|
||||
private:
|
||||
bool isOutputConsole = false;
|
||||
bool isOutputPartImg = false;
|
||||
bool isOutputResultTxt = false;
|
||||
bool isOutputResultImg = false;
|
||||
FILE *resultTxt;
|
||||
DbNet dbNet;
|
||||
AngleNet angleNet;
|
||||
CrnnNet crnnNet;
|
||||
|
||||
std::vector<cv::Mat> getPartImages(cv::Mat &src, std::vector<TextBox> &textBoxes,
|
||||
const char *path, const char *imgName);
|
||||
|
||||
OcrResult detect(const char *path, const char *imgName,
|
||||
cv::Mat &src, cv::Rect &originRect, ScaleParam &scale,
|
||||
float boxScoreThresh = 0.6f, float boxThresh = 0.3f,
|
||||
float unClipRatio = 2.0f, bool doAngle = true, bool mostAngle = true);
|
||||
};
|
||||
|
||||
#endif //__OCR_LITE_H__
|
||||
35
3rdparty/include/OcrLiteOnnx/OcrLiteCaller.h
vendored
Normal file
35
3rdparty/include/OcrLiteOnnx/OcrLiteCaller.h
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "OcrLitePort.h"
|
||||
#include "OcrStruct.h"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
class Mat;
|
||||
}
|
||||
class OcrLite;
|
||||
|
||||
class OCRLITE_PORT OcrLiteCaller
|
||||
{
|
||||
public:
|
||||
OcrLiteCaller();
|
||||
~OcrLiteCaller() = default;
|
||||
OcrLiteCaller(const OcrLite&) = delete;
|
||||
OcrLiteCaller(OcrLite&&) = delete;
|
||||
|
||||
void setNumThread(int numOfThread);
|
||||
void initModels(const std::string& detPath, const std::string& clsPath,
|
||||
const std::string& recPath, const std::string& keysPath);
|
||||
|
||||
OcrResult detect(const cv::Mat& mat,
|
||||
int padding, int maxSideLen,
|
||||
float boxScoreThresh, float boxThresh, float unClipRatio, bool doAngle, bool mostAngle);
|
||||
|
||||
OcrLiteCaller& operator=(const OcrLiteCaller&) = delete;
|
||||
OcrLiteCaller& operator=(OcrLiteCaller&&) = delete;
|
||||
private:
|
||||
std::shared_ptr<OcrLite> m_ocrlite_ptr;
|
||||
};
|
||||
37
3rdparty/include/OcrLiteOnnx/OcrLitePort.h
vendored
Normal file
37
3rdparty/include/OcrLiteOnnx/OcrLitePort.h
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#pragma once
|
||||
|
||||
// The way how the function is called
|
||||
#if !defined(OCRLITE_CALL)
|
||||
#if defined(_WIN32)
|
||||
#define OCRLITE_CALL __stdcall
|
||||
#else
|
||||
#define OCRLITE_CALL
|
||||
#endif /* _WIN32 */
|
||||
#endif /* ISSCALL */
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#define OCRLITE_EXPORT __declspec(dllexport)
|
||||
#define OCRLITE_IMPORT __declspec(dllimport)
|
||||
#define OCRLITE_LOCAL
|
||||
#else // ! defined _WIN32 || defined __CYGWIN__
|
||||
#if __GNUC__ >= 4
|
||||
#define OCRLITE_EXPORT __attribute__ ((visibility ("default")))
|
||||
#define OCRLITE_IMPORT __attribute__ ((visibility ("default")))
|
||||
#define OCRLITE_LOCAL __attribute__ ((visibility ("hidden")))
|
||||
#else // ! __GNUC__ >= 4
|
||||
#define OCRLITE_EXPORT
|
||||
#define OCRLITE_IMPORT
|
||||
#endif // End __GNUC__ >= 4
|
||||
#endif // End defined _WIN32 || defined __CYGWIN__
|
||||
|
||||
#ifdef __CLIB__
|
||||
#define OCRLITE_PORT OCRLITE_EXPORT
|
||||
#else
|
||||
#define OCRLITE_PORT OCRLITE_IMPORT
|
||||
#endif // OCRLITE_PORT
|
||||
|
||||
#define OCR_API OCRLITE_PORT OCRLITE_CALL
|
||||
|
||||
#define OCR_LOCAL OCRLITE_LOCAL OCRLITE_CALL
|
||||
55
3rdparty/include/OcrLiteOnnx/OcrStruct.h
vendored
Normal file
55
3rdparty/include/OcrLiteOnnx/OcrStruct.h
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifndef __OCR_STRUCT_H__
|
||||
#define __OCR_STRUCT_H__
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include <vector>
|
||||
|
||||
#include "OcrLitePort.h"
|
||||
|
||||
struct ScaleParam {
|
||||
int srcWidth;
|
||||
int srcHeight;
|
||||
int dstWidth;
|
||||
int dstHeight;
|
||||
float ratioWidth;
|
||||
float ratioHeight;
|
||||
};
|
||||
|
||||
struct TextBox {
|
||||
std::vector<cv::Point> boxPoint;
|
||||
float score;
|
||||
};
|
||||
|
||||
struct Angle {
|
||||
int index;
|
||||
float score;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct TextLine {
|
||||
std::string text;
|
||||
std::vector<float> charScores;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct OCRLITE_PORT TextBlock {
|
||||
std::vector<cv::Point> boxPoint;
|
||||
float boxScore;
|
||||
int angleIndex;
|
||||
float angleScore;
|
||||
double angleTime;
|
||||
std::string text;
|
||||
std::vector<float> charScores;
|
||||
double crnnTime;
|
||||
double blockTime;
|
||||
};
|
||||
|
||||
struct OCRLITE_PORT OcrResult {
|
||||
double dbNetTime;
|
||||
std::vector<TextBlock> textBlocks;
|
||||
cv::Mat boxImg;
|
||||
double detectTime;
|
||||
std::string strRes;
|
||||
};
|
||||
|
||||
#endif //__OCR_STRUCT_H__
|
||||
103
3rdparty/include/OcrLiteOnnx/OcrUtils.h
vendored
Normal file
103
3rdparty/include/OcrLiteOnnx/OcrUtils.h
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
#ifndef __OCR_UTILS_H__
|
||||
#define __OCR_UTILS_H__
|
||||
|
||||
#include <opencv2/core.hpp>
|
||||
#include "OcrStruct.h"
|
||||
#include "onnxruntime_cxx_api.h"
|
||||
#include <numeric>
|
||||
#include <sys/stat.h>
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
static std::unique_ptr<T> makeUnique(Ts &&... params) {
|
||||
return std::unique_ptr<T>(new T(std::forward<Ts>(params)...));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static double getMean(std::vector<T> &input) {
|
||||
auto sum = accumulate(input.begin(), input.end(), 0.0);
|
||||
return sum / input.size();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static double getStdev(std::vector<T> &input, double mean) {
|
||||
if (input.size() <= 1) return 0;
|
||||
double accum = 0.0;
|
||||
for_each(input.begin(), input.end(), [&](const double d) {
|
||||
accum += (d - mean) * (d - mean);
|
||||
});
|
||||
double stdev = sqrt(accum / (input.size() - 1));
|
||||
return stdev;
|
||||
}
|
||||
|
||||
double getCurrentTime();
|
||||
|
||||
inline bool isFileExists(const std::string &name) {
|
||||
struct stat buffer;
|
||||
return (stat(name.c_str(), &buffer) == 0);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#define my_strtol wcstol
|
||||
#define my_strrchr wcsrchr
|
||||
#define my_strcasecmp _wcsicmp
|
||||
#define my_strdup _strdup
|
||||
#else
|
||||
#define my_strtol strtol
|
||||
#define my_strrchr strrchr
|
||||
#define my_strcasecmp strcasecmp
|
||||
#define my_strdup strdup
|
||||
#endif
|
||||
|
||||
std::wstring strToWstr(std::string str);
|
||||
|
||||
ScaleParam getScaleParam(cv::Mat &src, const float scale);
|
||||
|
||||
ScaleParam getScaleParam(cv::Mat &src, const int targetSize);
|
||||
|
||||
std::vector<cv::Point2f> getBox(const cv::RotatedRect &rect);
|
||||
|
||||
int getThickness(cv::Mat &boxImg);
|
||||
|
||||
void drawTextBox(cv::Mat &boxImg, cv::RotatedRect &rect, int thickness);
|
||||
|
||||
void drawTextBox(cv::Mat &boxImg, const std::vector<cv::Point> &box, int thickness);
|
||||
|
||||
void drawTextBoxes(cv::Mat &boxImg, std::vector<TextBox> &textBoxes, int thickness);
|
||||
|
||||
cv::Mat matRotateClockWise180(cv::Mat src);
|
||||
|
||||
cv::Mat matRotateClockWise90(cv::Mat src);
|
||||
|
||||
cv::Mat getRotateCropImage(const cv::Mat &src, std::vector<cv::Point> box);
|
||||
|
||||
cv::Mat adjustTargetImg(cv::Mat &src, int dstWidth, int dstHeight);
|
||||
|
||||
std::vector<cv::Point> getMinBoxes(const std::vector<cv::Point> &inVec, float &minSideLen, float &allEdgeSize);
|
||||
|
||||
float boxScoreFast(const cv::Mat &inMat, const std::vector<cv::Point> &inBox);
|
||||
|
||||
std::vector<cv::Point> unClip(const std::vector<cv::Point> &inBox, float perimeter, float unClipRatio);
|
||||
|
||||
std::vector<float> substractMeanNormalize(cv::Mat &src, const float *meanVals, const float *normVals);
|
||||
|
||||
std::vector<int> getAngleIndexes(std::vector<Angle> &angles);
|
||||
|
||||
std::vector<char *> getInputNames(Ort::Session *session);
|
||||
|
||||
std::vector<char *> getOutputNames(Ort::Session *session);
|
||||
|
||||
void getInputName(Ort::Session *session, char *&inputName);
|
||||
|
||||
void getOutputName(Ort::Session *session, char *&outputName);
|
||||
|
||||
void saveImg(cv::Mat &img, const char *imgPath);
|
||||
|
||||
std::string getSrcImgFilePath(const char *path, const char *imgName);
|
||||
|
||||
std::string getResultTxtFilePath(const char *path, const char *imgName);
|
||||
|
||||
std::string getResultImgFilePath(const char *path, const char *imgName);
|
||||
|
||||
std::string getDebugImgFilePath(const char *path, const char *imgName, int i, const char *tag);
|
||||
|
||||
#endif //__OCR_UTILS_H__
|
||||
47
3rdparty/include/OcrLiteOnnx/getopt.h
vendored
Normal file
47
3rdparty/include/OcrLiteOnnx/getopt.h
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* getopt - POSIX like getopt for Windows console Application
|
||||
*
|
||||
* win-c - Windows Console Library
|
||||
* Copyright (c) 2015 Koji Takami
|
||||
* Released under the MIT license
|
||||
* https://github.com/takamin/win-c/blob/master/LICENSE
|
||||
*/
|
||||
#ifndef _GETOPT_H_
|
||||
#define _GETOPT_H_
|
||||
|
||||
#ifndef __CLIB__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
int getopt(int argc, char *const argv[],
|
||||
const char *optstring);
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
struct option {
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
int getopt_long(int argc, char *const argv[],
|
||||
const char *optstring,
|
||||
const struct option *longopts, int *longindex);
|
||||
/****************************************************************************
|
||||
int getopt_long_only(int argc, char* const argv[],
|
||||
const char* optstring,
|
||||
const struct option* longopts, int* longindex);
|
||||
****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
#endif // _GETOPT_H_
|
||||
56
3rdparty/include/OcrLiteOnnx/main.h
vendored
Normal file
56
3rdparty/include/OcrLiteOnnx/main.h
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
#ifndef __CLIB__
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
static const struct option long_options[] = {
|
||||
{"models", required_argument, NULL, 'd'},
|
||||
{"det", required_argument, NULL, '1'},
|
||||
{"cls", required_argument, NULL, '2'},
|
||||
{"rec", required_argument, NULL, '3'},
|
||||
{"keys", required_argument, NULL, '4'},
|
||||
{"image", required_argument, NULL, 'i'},
|
||||
{"numThread", required_argument, NULL, 't'},
|
||||
{"padding", required_argument, NULL, 'p'},
|
||||
{"maxSideLen", required_argument, NULL, 's'},
|
||||
{"boxScoreThresh", required_argument, NULL, 'b'},
|
||||
{"boxThresh", required_argument, NULL, 'o'},
|
||||
{"unClipRatio", required_argument, NULL, 'u'},
|
||||
{"doAngle", required_argument, NULL, 'a'},
|
||||
{"mostAngle", required_argument, NULL, 'A'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"loopCount", required_argument, NULL, 'l'},
|
||||
{NULL, no_argument, NULL, 0}
|
||||
};
|
||||
|
||||
const char *usageMsg = "(-d --models) (-1 --det) (-2 --cls) (-3 --rec) (-4 --keys) (-i --image)\n"\
|
||||
"[-t --numThread] [-p --padding] [-s --maxSideLen]\n" \
|
||||
"[-b --boxScoreThresh] [-o --boxThresh] [-u --unClipRatio]\n" \
|
||||
"[-a --noAngle] [-A --mostAngle]\n\n";
|
||||
|
||||
const char *requiredMsg = "-d --models: models directory.\n" \
|
||||
"-1 --det: model file name of det.\n" \
|
||||
"-2 --cls: model file name of cls.\n" \
|
||||
"-3 --rec: model file name of rec.\n" \
|
||||
"-4 --keys: keys file name.\n" \
|
||||
"-i --image: path of target image.\n\n";
|
||||
|
||||
const char *optionalMsg = "-t --numThread: value of numThread(int), default: 4\n" \
|
||||
"-p --padding: value of padding(int), default: 50\n" \
|
||||
"-s --maxSideLen: Long side of picture for resize(int), default: 1024\n" \
|
||||
"-b --boxScoreThresh: value of boxScoreThresh(float), default: 0.6\n" \
|
||||
"-o --boxThresh: value of boxThresh(float), default: 0.3\n" \
|
||||
"-u --unClipRatio: value of unClipRatio(float), default: 2.0\n" \
|
||||
"-a --doAngle: Enable(1)/Disable(0) Angle Net, default: Enable\n" \
|
||||
"-A --mostAngle: Enable(1)/Disable(0) Most Possible AngleIndex, default: Enable\n\n";
|
||||
|
||||
const char *otherMsg = "-v --version: show version\n" \
|
||||
"-h --help: print this help\n\n";
|
||||
|
||||
const char *example1Msg = "Example1: %s --models models --det det.onnx --cls cls.onnx --rec rec.onnx --keys keys.txt --image 1.jpg\n";
|
||||
const char *example2Msg = "Example2: %s -d models -1 det.onnx -2 cls.onnx -3 rec.onnx -4 keys.txt -i 1.jpg -t 4 -p 50 -s 0 -b 0.6 -o 0.3 -u 2.0 -a 1 -A 1\n";
|
||||
|
||||
#endif
|
||||
#endif //__MAIN_H__
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef __OCR_VERSION_H__
|
||||
#define __OCR_VERSION_H__
|
||||
|
||||
namespace ocr {
|
||||
static const char* VERSION = "1.5.1.20210128";
|
||||
}
|
||||
#define VERSION "1.5.1.20210128"
|
||||
|
||||
#endif //__OCR_VERSION_H__
|
||||
@@ -18,18 +18,27 @@ namespace json
|
||||
using const_reverse_iterator = raw_array::const_reverse_iterator;
|
||||
|
||||
array() = default;
|
||||
array(const array &rhs) = default;
|
||||
array(array &&rhs) noexcept = default;
|
||||
array(const raw_array &arr);
|
||||
array(raw_array &&arr) noexcept;
|
||||
array(const array& rhs) = default;
|
||||
array(array&& rhs) noexcept = default;
|
||||
array(const raw_array& arr);
|
||||
array(raw_array&& arr) noexcept;
|
||||
array(std::initializer_list<raw_array::value_type> init_list);
|
||||
template<typename ArrayType>
|
||||
array(ArrayType arr) {
|
||||
static_assert(
|
||||
std::is_constructible<json::value, typename ArrayType::value_type>::value,
|
||||
"Parameter can't be used to construct a json::value");
|
||||
for (auto&& ele : arr) {
|
||||
_array_data.emplace_back(std::move(ele));
|
||||
}
|
||||
}
|
||||
|
||||
~array() noexcept = default;
|
||||
|
||||
bool empty() const noexcept { return _array_data.empty(); }
|
||||
size_t size() const noexcept { return _array_data.size(); }
|
||||
bool exist(size_t pos) const { return _array_data.size() < pos; }
|
||||
const value &at(size_t pos) const;
|
||||
const value& at(size_t pos) const;
|
||||
const std::string to_string() const;
|
||||
const std::string format(std::string shift_str = " ", size_t basic_shift_count = 0) const;
|
||||
|
||||
@@ -43,7 +52,7 @@ namespace json
|
||||
const double get(size_t pos, double default_value) const;
|
||||
const long double get(size_t pos, long double default_value) const;
|
||||
const std::string get(size_t pos, std::string default_value) const;
|
||||
const std::string get(size_t pos, const char * default_value) const;
|
||||
const std::string get(size_t pos, const char* default_value) const;
|
||||
|
||||
template <typename... Args>
|
||||
decltype(auto) emplace_back(Args &&... args)
|
||||
@@ -59,19 +68,23 @@ namespace json
|
||||
|
||||
iterator begin() noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
reverse_iterator rbegin() noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
const value &operator[](size_t pos) const;
|
||||
value &operator[](size_t pos);
|
||||
const value& operator[](size_t pos) const;
|
||||
value& operator[](size_t pos);
|
||||
|
||||
array &operator=(const array &) = default;
|
||||
array &operator=(array &&) noexcept = default;
|
||||
array& operator=(const array&) = default;
|
||||
array& operator=(array&&) noexcept = default;
|
||||
|
||||
// const raw_array &raw_data() const;
|
||||
|
||||
@@ -79,6 +92,6 @@ namespace json
|
||||
raw_array _array_data;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const array &arr);
|
||||
std::ostream& operator<<(std::ostream& out, const array& arr);
|
||||
|
||||
} // namespace json
|
||||
97
3rdparty/include/meojson/json_aux.h
vendored
Normal file
97
3rdparty/include/meojson/json_aux.h
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "json_value.h"
|
||||
|
||||
namespace json
|
||||
{
|
||||
static std::string unescape_string(std::string&& str)
|
||||
{
|
||||
std::string replace_str;
|
||||
std::string escape_str = std::move(str);
|
||||
|
||||
for (size_t pos = 0; pos < escape_str.size(); ++pos)
|
||||
{
|
||||
switch (escape_str[pos]) {
|
||||
case '\"':
|
||||
replace_str = R"(\")";
|
||||
break;
|
||||
case '\\':
|
||||
replace_str = R"(\\)";
|
||||
break;
|
||||
case '\b':
|
||||
replace_str = R"(\b)";
|
||||
break;
|
||||
case '\f':
|
||||
replace_str = R"(\f)";
|
||||
break;
|
||||
case '\n':
|
||||
replace_str = R"(\n)";
|
||||
break;
|
||||
case '\r':
|
||||
replace_str = R"(\r)";
|
||||
break;
|
||||
case '\t':
|
||||
replace_str = R"(\t)";
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
escape_str.replace(pos, 1, replace_str);
|
||||
++pos;
|
||||
}
|
||||
return escape_str;
|
||||
}
|
||||
|
||||
static std::string unescape_string(const std::string& str)
|
||||
{
|
||||
return unescape_string(std::string(str));
|
||||
}
|
||||
|
||||
static std::string escape_string(std::string&& str)
|
||||
{
|
||||
std::string escape_str = std::move(str);
|
||||
|
||||
for (size_t pos = 0; pos + 1 < escape_str.size(); ++pos)
|
||||
{
|
||||
if (escape_str[pos] != '\\') {
|
||||
continue;
|
||||
}
|
||||
std::string replace_str;
|
||||
switch (escape_str[pos+1]) {
|
||||
case '"':
|
||||
replace_str = "\"";
|
||||
break;
|
||||
case '\\':
|
||||
replace_str = "\\";
|
||||
break;
|
||||
case 'b':
|
||||
replace_str = "\b";
|
||||
break;
|
||||
case 'f':
|
||||
replace_str = "\f";
|
||||
break;
|
||||
case 'n':
|
||||
replace_str = "\n";
|
||||
break;
|
||||
case 'r':
|
||||
replace_str = "\r";
|
||||
break;
|
||||
case 't':
|
||||
replace_str = "\r";
|
||||
break;
|
||||
default:
|
||||
return std::string();
|
||||
break;
|
||||
}
|
||||
escape_str.replace(pos, 2, replace_str);
|
||||
}
|
||||
return escape_str;
|
||||
}
|
||||
|
||||
static std::string escape_string(const std::string& str)
|
||||
{
|
||||
return escape_string(std::string(str));
|
||||
}
|
||||
}
|
||||
27
3rdparty/include/meojson/json_exception.h
vendored
Normal file
27
3rdparty/include/meojson/json_exception.h
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
namespace json
|
||||
{
|
||||
class exception : public std::exception
|
||||
{
|
||||
public:
|
||||
exception() = default;
|
||||
exception(const std::string& msg);
|
||||
|
||||
exception(const exception&) = default;
|
||||
exception& operator=(const exception&) = default;
|
||||
exception(exception&&) = default;
|
||||
exception& operator=(exception&&) = default;
|
||||
|
||||
virtual ~exception() noexcept override = default;
|
||||
|
||||
virtual const char* what() const noexcept override;
|
||||
|
||||
private:
|
||||
std::string m_msg;
|
||||
};
|
||||
|
||||
} // namespace json
|
||||
@@ -21,7 +21,16 @@ namespace json
|
||||
object(const raw_object& raw_obj);
|
||||
object(raw_object&& raw_obj);
|
||||
object(std::initializer_list<raw_object::value_type> init_list);
|
||||
|
||||
template<typename MapType>
|
||||
object(MapType map) {
|
||||
static_assert(
|
||||
std::is_constructible<raw_object::value_type, typename MapType::value_type>::value,
|
||||
"Parameter can't be used to construct a json::object::raw_object::value_type");
|
||||
for (auto&& ele : map) {
|
||||
_object_data.emplace(std::move(ele));
|
||||
}
|
||||
}
|
||||
|
||||
~object() = default;
|
||||
|
||||
bool empty() const noexcept { return _object_data.empty(); }
|
||||
@@ -57,6 +66,8 @@ namespace json
|
||||
|
||||
iterator begin() noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
@@ -15,12 +15,12 @@ namespace json
|
||||
public:
|
||||
~parser() noexcept = default;
|
||||
|
||||
static std::optional<value> parse(const std::string &content);
|
||||
static std::optional<value> parse(const std::string& content);
|
||||
|
||||
private:
|
||||
parser(
|
||||
const std::string::const_iterator &cbegin,
|
||||
const std::string::const_iterator &cend) noexcept
|
||||
const std::string::const_iterator& cbegin,
|
||||
const std::string::const_iterator& cend) noexcept
|
||||
: _cur(cbegin), _end(cend) {}
|
||||
|
||||
std::optional<value> parse();
|
||||
@@ -44,4 +44,7 @@ namespace json
|
||||
std::string::const_iterator _cur;
|
||||
std::string::const_iterator _end;
|
||||
};
|
||||
|
||||
std::optional<value> parse(const std::string& content);
|
||||
|
||||
} // namespace json
|
||||
@@ -29,8 +29,8 @@ namespace json
|
||||
|
||||
public:
|
||||
value();
|
||||
value(const value &rhs);
|
||||
value(value &&rhs) noexcept;
|
||||
value(const value& rhs);
|
||||
value(value&& rhs) noexcept;
|
||||
|
||||
value(bool b);
|
||||
|
||||
@@ -44,24 +44,24 @@ namespace json
|
||||
value(double num);
|
||||
value(long double num);
|
||||
|
||||
value(const char *str);
|
||||
value(const std::string &str);
|
||||
value(std::string &&str);
|
||||
value(const char* str);
|
||||
value(const std::string& str);
|
||||
value(std::string&& str);
|
||||
|
||||
value(const array &arr);
|
||||
value(array &&arr);
|
||||
value(const array& arr);
|
||||
value(array&& arr);
|
||||
// value(std::initializer_list<value> init_list); // for array
|
||||
|
||||
value(const object &obj);
|
||||
value(object &&obj);
|
||||
value(const object& obj);
|
||||
value(object&& obj);
|
||||
// error: conversion from ‘<brace-enclosed initializer list>’ to ‘json::value’ is ambiguous
|
||||
// value(std::initializer_list<std::pair<std::string, value>> init_list); // for object
|
||||
|
||||
// Constructed from raw data
|
||||
template <typename... Args>
|
||||
value(value_type type, Args &&... args)
|
||||
value(value_type type, Args &&...args)
|
||||
: _type(type),
|
||||
_raw_data(std::forward<Args>(args)...)
|
||||
_raw_data(std::forward<Args>(args)...)
|
||||
{
|
||||
static_assert(
|
||||
std::is_constructible<std::string, Args...>::value,
|
||||
@@ -85,15 +85,17 @@ namespace json
|
||||
bool exist(const std::string& key) const;
|
||||
bool exist(size_t pos) const;
|
||||
value_type type() const noexcept { return _type; }
|
||||
const value &at(size_t pos) const;
|
||||
const value &at(const std::string &key) const;
|
||||
const value& at(size_t pos) const;
|
||||
const value& at(const std::string& key) const;
|
||||
|
||||
template<typename Type>
|
||||
decltype(auto) get(const std::string& key, Type default_value) {
|
||||
template <typename Type>
|
||||
decltype(auto) get(const std::string& key, Type default_value) const
|
||||
{
|
||||
return is_object() ? as_object().get(key, default_value) : default_value;
|
||||
}
|
||||
template<typename Type>
|
||||
decltype(auto) get(size_t pos, Type default_value) {
|
||||
template <typename Type>
|
||||
decltype(auto) get(size_t pos, Type default_value) const
|
||||
{
|
||||
return is_array() ? as_array().get(pos, default_value) : default_value;
|
||||
}
|
||||
|
||||
@@ -108,8 +110,8 @@ namespace json
|
||||
const double as_double() const;
|
||||
const long double as_long_double() const;
|
||||
const std::string as_string() const;
|
||||
const array & as_array() const;
|
||||
const object & as_object() const;
|
||||
const array& as_array() const;
|
||||
const object& as_object() const;
|
||||
|
||||
array& as_array();
|
||||
object& as_object();
|
||||
@@ -118,18 +120,29 @@ namespace json
|
||||
const std::string to_string() const;
|
||||
const std::string format(std::string shift_str = " ", size_t basic_shift_count = 0) const;
|
||||
|
||||
value &operator=(const value &rhs);
|
||||
value &operator=(value &&) noexcept;
|
||||
value& operator=(const value& rhs);
|
||||
value& operator=(value&&) noexcept;
|
||||
|
||||
const value &operator[](size_t pos) const;
|
||||
value &operator[](size_t pos);
|
||||
value &operator[](const std::string &key);
|
||||
value &operator[](std::string &&key);
|
||||
explicit operator bool() const noexcept { return valid(); }
|
||||
const value& operator[](size_t pos) const;
|
||||
value& operator[](size_t pos);
|
||||
value& operator[](const std::string& key);
|
||||
value& operator[](std::string&& key);
|
||||
//explicit operator bool() const noexcept { return valid(); }
|
||||
|
||||
explicit operator bool() const { return as_boolean(); }
|
||||
explicit operator int() const { return as_integer(); }
|
||||
explicit operator long() const { return as_long(); }
|
||||
explicit operator unsigned long() const { return as_unsigned_long(); }
|
||||
explicit operator long long() const { return as_long_long(); }
|
||||
explicit operator unsigned long long() const { return as_unsigned_long_long(); }
|
||||
explicit operator float() const { return as_float(); }
|
||||
explicit operator double() const { return as_double(); }
|
||||
explicit operator long double() const { return as_long_double(); }
|
||||
explicit operator std::string() const { return as_string(); }
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
static std::unique_ptr<T> copy_unique_ptr(const std::unique_ptr<T> &t)
|
||||
static std::unique_ptr<T> copy_unique_ptr(const std::unique_ptr<T>& t)
|
||||
{
|
||||
return t == nullptr ? nullptr : std::make_unique<T>(*t);
|
||||
}
|
||||
@@ -141,7 +154,7 @@ namespace json
|
||||
};
|
||||
|
||||
const value invalid_value();
|
||||
std::ostream &operator<<(std::ostream &out, const value &val);
|
||||
std::ostream& operator<<(std::ostream& out, const value& val);
|
||||
// std::istream &operator>>(std::istream &in, value &val);
|
||||
|
||||
} // namespace json
|
||||
604
3rdparty/include/opencv2/aruco.hpp
vendored
Normal file
604
3rdparty/include/opencv2/aruco.hpp
vendored
Normal file
@@ -0,0 +1,604 @@
|
||||
/*
|
||||
By downloading, copying, installing or using the software you agree to this
|
||||
license. If you do not agree to this license, do not download, install,
|
||||
copy or use the software.
|
||||
|
||||
License Agreement
|
||||
For Open Source Computer Vision Library
|
||||
(3-clause BSD License)
|
||||
|
||||
Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||
Third party copyrights are property of their respective owners.
|
||||
|
||||
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 names of the copyright holders nor the names of the 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 copyright holders 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.
|
||||
*/
|
||||
|
||||
#ifndef __OPENCV_ARUCO_HPP__
|
||||
#define __OPENCV_ARUCO_HPP__
|
||||
|
||||
#include <opencv2/core.hpp>
|
||||
#include <vector>
|
||||
#include "opencv2/aruco/dictionary.hpp"
|
||||
|
||||
/**
|
||||
* @defgroup aruco ArUco Marker Detection
|
||||
* This module is dedicated to square fiducial markers (also known as Augmented Reality Markers)
|
||||
* These markers are useful for easy, fast and robust camera pose estimation.ç
|
||||
*
|
||||
* The main functionalities are:
|
||||
* - Detection of markers in an image
|
||||
* - Pose estimation from a single marker or from a board/set of markers
|
||||
* - Detection of ChArUco board for high subpixel accuracy
|
||||
* - Camera calibration from both, ArUco boards and ChArUco boards.
|
||||
* - Detection of ChArUco diamond markers
|
||||
* The samples directory includes easy examples of how to use the module.
|
||||
*
|
||||
* The implementation is based on the ArUco Library by R. Muñoz-Salinas and S. Garrido-Jurado @cite Aruco2014.
|
||||
*
|
||||
* Markers can also be detected based on the AprilTag 2 @cite wang2016iros fiducial detection method.
|
||||
*
|
||||
* @sa S. Garrido-Jurado, R. Muñoz-Salinas, F. J. Madrid-Cuevas, and M. J. Marín-Jiménez. 2014.
|
||||
* "Automatic generation and detection of highly reliable fiducial markers under occlusion".
|
||||
* Pattern Recogn. 47, 6 (June 2014), 2280-2292. DOI=10.1016/j.patcog.2014.01.005
|
||||
*
|
||||
* @sa http://www.uco.es/investiga/grupos/ava/node/26
|
||||
*
|
||||
* This module has been originally developed by Sergio Garrido-Jurado as a project
|
||||
* for Google Summer of Code 2015 (GSoC 15).
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace cv {
|
||||
namespace aruco {
|
||||
|
||||
//! @addtogroup aruco
|
||||
//! @{
|
||||
|
||||
enum CornerRefineMethod{
|
||||
CORNER_REFINE_NONE, ///< Tag and corners detection based on the ArUco approach
|
||||
CORNER_REFINE_SUBPIX, ///< ArUco approach and refine the corners locations using corner subpixel accuracy
|
||||
CORNER_REFINE_CONTOUR, ///< ArUco approach and refine the corners locations using the contour-points line fitting
|
||||
CORNER_REFINE_APRILTAG, ///< Tag and corners detection based on the AprilTag 2 approach @cite wang2016iros
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Parameters for the detectMarker process:
|
||||
* - adaptiveThreshWinSizeMin: minimum window size for adaptive thresholding before finding
|
||||
* contours (default 3).
|
||||
* - adaptiveThreshWinSizeMax: maximum window size for adaptive thresholding before finding
|
||||
* contours (default 23).
|
||||
* - adaptiveThreshWinSizeStep: increments from adaptiveThreshWinSizeMin to adaptiveThreshWinSizeMax
|
||||
* during the thresholding (default 10).
|
||||
* - adaptiveThreshConstant: constant for adaptive thresholding before finding contours (default 7)
|
||||
* - minMarkerPerimeterRate: determine minimum perimeter for marker contour to be detected. This
|
||||
* is defined as a rate respect to the maximum dimension of the input image (default 0.03).
|
||||
* - maxMarkerPerimeterRate: determine maximum perimeter for marker contour to be detected. This
|
||||
* is defined as a rate respect to the maximum dimension of the input image (default 4.0).
|
||||
* - polygonalApproxAccuracyRate: minimum accuracy during the polygonal approximation process to
|
||||
* determine which contours are squares. (default 0.03)
|
||||
* - minCornerDistanceRate: minimum distance between corners for detected markers relative to its
|
||||
* perimeter (default 0.05)
|
||||
* - minDistanceToBorder: minimum distance of any corner to the image border for detected markers
|
||||
* (in pixels) (default 3)
|
||||
* - minMarkerDistanceRate: minimum mean distance beetween two marker corners to be considered
|
||||
* similar, so that the smaller one is removed. The rate is relative to the smaller perimeter
|
||||
* of the two markers (default 0.05).
|
||||
* - cornerRefinementMethod: corner refinement method. (CORNER_REFINE_NONE, no refinement.
|
||||
* CORNER_REFINE_SUBPIX, do subpixel refinement. CORNER_REFINE_CONTOUR use contour-Points,
|
||||
* CORNER_REFINE_APRILTAG use the AprilTag2 approach). (default CORNER_REFINE_NONE)
|
||||
* - cornerRefinementWinSize: window size for the corner refinement process (in pixels) (default 5).
|
||||
* - cornerRefinementMaxIterations: maximum number of iterations for stop criteria of the corner
|
||||
* refinement process (default 30).
|
||||
* - cornerRefinementMinAccuracy: minimum error for the stop cristeria of the corner refinement
|
||||
* process (default: 0.1)
|
||||
* - markerBorderBits: number of bits of the marker border, i.e. marker border width (default 1).
|
||||
* - perspectiveRemovePixelPerCell: number of bits (per dimension) for each cell of the marker
|
||||
* when removing the perspective (default 4).
|
||||
* - perspectiveRemoveIgnoredMarginPerCell: width of the margin of pixels on each cell not
|
||||
* considered for the determination of the cell bit. Represents the rate respect to the total
|
||||
* size of the cell, i.e. perspectiveRemovePixelPerCell (default 0.13)
|
||||
* - maxErroneousBitsInBorderRate: maximum number of accepted erroneous bits in the border (i.e.
|
||||
* number of allowed white bits in the border). Represented as a rate respect to the total
|
||||
* number of bits per marker (default 0.35).
|
||||
* - minOtsuStdDev: minimun standard deviation in pixels values during the decodification step to
|
||||
* apply Otsu thresholding (otherwise, all the bits are set to 0 or 1 depending on mean higher
|
||||
* than 128 or not) (default 5.0)
|
||||
* - errorCorrectionRate error correction rate respect to the maximun error correction capability
|
||||
* for each dictionary. (default 0.6).
|
||||
* - aprilTagMinClusterPixels: reject quads containing too few pixels. (default 5)
|
||||
* - aprilTagMaxNmaxima: how many corner candidates to consider when segmenting a group of pixels into a quad. (default 10)
|
||||
* - aprilTagCriticalRad: Reject quads where pairs of edges have angles that are close to straight or close to
|
||||
* 180 degrees. Zero means that no quads are rejected. (In radians) (default 10*PI/180)
|
||||
* - aprilTagMaxLineFitMse: When fitting lines to the contours, what is the maximum mean squared error
|
||||
* allowed? This is useful in rejecting contours that are far from being quad shaped; rejecting
|
||||
* these quads "early" saves expensive decoding processing. (default 10.0)
|
||||
* - aprilTagMinWhiteBlackDiff: When we build our model of black & white pixels, we add an extra check that
|
||||
* the white model must be (overall) brighter than the black model. How much brighter? (in pixel values, [0,255]). (default 5)
|
||||
* - aprilTagDeglitch: should the thresholded image be deglitched? Only useful for very noisy images. (default 0)
|
||||
* - aprilTagQuadDecimate: Detection of quads can be done on a lower-resolution image, improving speed at a
|
||||
* cost of pose accuracy and a slight decrease in detection rate. Decoding the binary payload is still
|
||||
* done at full resolution. (default 0.0)
|
||||
* - aprilTagQuadSigma: What Gaussian blur should be applied to the segmented image (used for quad detection?)
|
||||
* Parameter is the standard deviation in pixels. Very noisy images benefit from non-zero values (e.g. 0.8). (default 0.0)
|
||||
* - detectInvertedMarker: to check if there is a white marker. In order to generate a "white" marker just
|
||||
* invert a normal marker by using a tilde, ~markerImage. (default false)
|
||||
*/
|
||||
struct CV_EXPORTS_W DetectorParameters {
|
||||
|
||||
DetectorParameters();
|
||||
|
||||
CV_WRAP static Ptr<DetectorParameters> create();
|
||||
|
||||
CV_PROP_RW int adaptiveThreshWinSizeMin;
|
||||
CV_PROP_RW int adaptiveThreshWinSizeMax;
|
||||
CV_PROP_RW int adaptiveThreshWinSizeStep;
|
||||
CV_PROP_RW double adaptiveThreshConstant;
|
||||
CV_PROP_RW double minMarkerPerimeterRate;
|
||||
CV_PROP_RW double maxMarkerPerimeterRate;
|
||||
CV_PROP_RW double polygonalApproxAccuracyRate;
|
||||
CV_PROP_RW double minCornerDistanceRate;
|
||||
CV_PROP_RW int minDistanceToBorder;
|
||||
CV_PROP_RW double minMarkerDistanceRate;
|
||||
CV_PROP_RW int cornerRefinementMethod;
|
||||
CV_PROP_RW int cornerRefinementWinSize;
|
||||
CV_PROP_RW int cornerRefinementMaxIterations;
|
||||
CV_PROP_RW double cornerRefinementMinAccuracy;
|
||||
CV_PROP_RW int markerBorderBits;
|
||||
CV_PROP_RW int perspectiveRemovePixelPerCell;
|
||||
CV_PROP_RW double perspectiveRemoveIgnoredMarginPerCell;
|
||||
CV_PROP_RW double maxErroneousBitsInBorderRate;
|
||||
CV_PROP_RW double minOtsuStdDev;
|
||||
CV_PROP_RW double errorCorrectionRate;
|
||||
|
||||
// April :: User-configurable parameters.
|
||||
CV_PROP_RW float aprilTagQuadDecimate;
|
||||
CV_PROP_RW float aprilTagQuadSigma;
|
||||
|
||||
// April :: Internal variables
|
||||
CV_PROP_RW int aprilTagMinClusterPixels;
|
||||
CV_PROP_RW int aprilTagMaxNmaxima;
|
||||
CV_PROP_RW float aprilTagCriticalRad;
|
||||
CV_PROP_RW float aprilTagMaxLineFitMse;
|
||||
CV_PROP_RW int aprilTagMinWhiteBlackDiff;
|
||||
CV_PROP_RW int aprilTagDeglitch;
|
||||
|
||||
// to detect white (inverted) markers
|
||||
CV_PROP_RW bool detectInvertedMarker;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Basic marker detection
|
||||
*
|
||||
* @param image input image
|
||||
* @param dictionary indicates the type of markers that will be searched
|
||||
* @param corners vector of detected marker corners. For each marker, its four corners
|
||||
* are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers,
|
||||
* the dimensions of this array is Nx4. The order of the corners is clockwise.
|
||||
* @param ids vector of identifiers of the detected markers. The identifier is of type int
|
||||
* (e.g. std::vector<int>). For N detected markers, the size of ids is also N.
|
||||
* The identifiers have the same order than the markers in the imgPoints array.
|
||||
* @param parameters marker detection parameters
|
||||
* @param rejectedImgPoints contains the imgPoints of those squares whose inner code has not a
|
||||
* correct codification. Useful for debugging purposes.
|
||||
* @param cameraMatrix optional input 3x3 floating-point camera matrix
|
||||
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
|
||||
* @param distCoeff optional vector of distortion coefficients
|
||||
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
|
||||
*
|
||||
* Performs marker detection in the input image. Only markers included in the specific dictionary
|
||||
* are searched. For each detected marker, it returns the 2D position of its corner in the image
|
||||
* and its corresponding identifier.
|
||||
* Note that this function does not perform pose estimation.
|
||||
* @sa estimatePoseSingleMarkers, estimatePoseBoard
|
||||
*
|
||||
*/
|
||||
CV_EXPORTS_W void detectMarkers(InputArray image, const Ptr<Dictionary> &dictionary, OutputArrayOfArrays corners,
|
||||
OutputArray ids, const Ptr<DetectorParameters> ¶meters = DetectorParameters::create(),
|
||||
OutputArrayOfArrays rejectedImgPoints = noArray(), InputArray cameraMatrix= noArray(), InputArray distCoeff= noArray());
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pose estimation for single markers
|
||||
*
|
||||
* @param corners vector of already detected markers corners. For each marker, its four corners
|
||||
* are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers,
|
||||
* the dimensions of this array should be Nx4. The order of the corners should be clockwise.
|
||||
* @sa detectMarkers
|
||||
* @param markerLength the length of the markers' side. The returning translation vectors will
|
||||
* be in the same unit. Normally, unit is meters.
|
||||
* @param cameraMatrix input 3x3 floating-point camera matrix
|
||||
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
|
||||
* @param distCoeffs vector of distortion coefficients
|
||||
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
|
||||
* @param rvecs array of output rotation vectors (@sa Rodrigues) (e.g. std::vector<cv::Vec3d>).
|
||||
* Each element in rvecs corresponds to the specific marker in imgPoints.
|
||||
* @param tvecs array of output translation vectors (e.g. std::vector<cv::Vec3d>).
|
||||
* Each element in tvecs corresponds to the specific marker in imgPoints.
|
||||
* @param _objPoints array of object points of all the marker corners
|
||||
*
|
||||
* This function receives the detected markers and returns their pose estimation respect to
|
||||
* the camera individually. So for each marker, one rotation and translation vector is returned.
|
||||
* The returned transformation is the one that transforms points from each marker coordinate system
|
||||
* to the camera coordinate system.
|
||||
* The marker corrdinate system is centered on the middle of the marker, with the Z axis
|
||||
* perpendicular to the marker plane.
|
||||
* The coordinates of the four corners of the marker in its own coordinate system are:
|
||||
* (-markerLength/2, markerLength/2, 0), (markerLength/2, markerLength/2, 0),
|
||||
* (markerLength/2, -markerLength/2, 0), (-markerLength/2, -markerLength/2, 0)
|
||||
*/
|
||||
CV_EXPORTS_W void estimatePoseSingleMarkers(InputArrayOfArrays corners, float markerLength,
|
||||
InputArray cameraMatrix, InputArray distCoeffs,
|
||||
OutputArray rvecs, OutputArray tvecs, OutputArray _objPoints = noArray());
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Board of markers
|
||||
*
|
||||
* A board is a set of markers in the 3D space with a common coordinate system.
|
||||
* The common form of a board of marker is a planar (2D) board, however any 3D layout can be used.
|
||||
* A Board object is composed by:
|
||||
* - The object points of the marker corners, i.e. their coordinates respect to the board system.
|
||||
* - The dictionary which indicates the type of markers of the board
|
||||
* - The identifier of all the markers in the board.
|
||||
*/
|
||||
class CV_EXPORTS_W Board {
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Provide way to create Board by passing necessary data. Specially needed in Python.
|
||||
*
|
||||
* @param objPoints array of object points of all the marker corners in the board
|
||||
* @param dictionary the dictionary of markers employed for this board
|
||||
* @param ids vector of the identifiers of the markers in the board
|
||||
*
|
||||
*/
|
||||
CV_WRAP static Ptr<Board> create(InputArrayOfArrays objPoints, const Ptr<Dictionary> &dictionary, InputArray ids);
|
||||
/// array of object points of all the marker corners in the board
|
||||
/// each marker include its 4 corners in CCW order. For M markers, the size is Mx4.
|
||||
CV_PROP std::vector< std::vector< Point3f > > objPoints;
|
||||
|
||||
/// the dictionary of markers employed for this board
|
||||
CV_PROP Ptr<Dictionary> dictionary;
|
||||
|
||||
/// vector of the identifiers of the markers in the board (same size than objPoints)
|
||||
/// The identifiers refers to the board dictionary
|
||||
CV_PROP std::vector< int > ids;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Planar board with grid arrangement of markers
|
||||
* More common type of board. All markers are placed in the same plane in a grid arrangement.
|
||||
* The board can be drawn using drawPlanarBoard() function (@sa drawPlanarBoard)
|
||||
*/
|
||||
class CV_EXPORTS_W GridBoard : public Board {
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Draw a GridBoard
|
||||
*
|
||||
* @param outSize size of the output image in pixels.
|
||||
* @param img output image with the board. The size of this image will be outSize
|
||||
* and the board will be on the center, keeping the board proportions.
|
||||
* @param marginSize minimum margins (in pixels) of the board in the output image
|
||||
* @param borderBits width of the marker borders.
|
||||
*
|
||||
* This function return the image of the GridBoard, ready to be printed.
|
||||
*/
|
||||
CV_WRAP void draw(Size outSize, OutputArray img, int marginSize = 0, int borderBits = 1);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Create a GridBoard object
|
||||
*
|
||||
* @param markersX number of markers in X direction
|
||||
* @param markersY number of markers in Y direction
|
||||
* @param markerLength marker side length (normally in meters)
|
||||
* @param markerSeparation separation between two markers (same unit as markerLength)
|
||||
* @param dictionary dictionary of markers indicating the type of markers
|
||||
* @param firstMarker id of first marker in dictionary to use on board.
|
||||
* @return the output GridBoard object
|
||||
*
|
||||
* This functions creates a GridBoard object given the number of markers in each direction and
|
||||
* the marker size and marker separation.
|
||||
*/
|
||||
CV_WRAP static Ptr<GridBoard> create(int markersX, int markersY, float markerLength,
|
||||
float markerSeparation, const Ptr<Dictionary> &dictionary, int firstMarker = 0);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
CV_WRAP Size getGridSize() const { return Size(_markersX, _markersY); }
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
CV_WRAP float getMarkerLength() const { return _markerLength; }
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
CV_WRAP float getMarkerSeparation() const { return _markerSeparation; }
|
||||
|
||||
|
||||
private:
|
||||
// number of markers in X and Y directions
|
||||
int _markersX, _markersY;
|
||||
|
||||
// marker side length (normally in meters)
|
||||
float _markerLength;
|
||||
|
||||
// separation between markers in the grid
|
||||
float _markerSeparation;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pose estimation for a board of markers
|
||||
*
|
||||
* @param corners vector of already detected markers corners. For each marker, its four corners
|
||||
* are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the
|
||||
* dimensions of this array should be Nx4. The order of the corners should be clockwise.
|
||||
* @param ids list of identifiers for each marker in corners
|
||||
* @param board layout of markers in the board. The layout is composed by the marker identifiers
|
||||
* and the positions of each marker corner in the board reference system.
|
||||
* @param cameraMatrix input 3x3 floating-point camera matrix
|
||||
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
|
||||
* @param distCoeffs vector of distortion coefficients
|
||||
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
|
||||
* @param rvec Output vector (e.g. cv::Mat) corresponding to the rotation vector of the board
|
||||
* (see cv::Rodrigues). Used as initial guess if not empty.
|
||||
* @param tvec Output vector (e.g. cv::Mat) corresponding to the translation vector of the board.
|
||||
* @param useExtrinsicGuess defines whether initial guess for \b rvec and \b tvec will be used or not.
|
||||
* Used as initial guess if not empty.
|
||||
*
|
||||
* This function receives the detected markers and returns the pose of a marker board composed
|
||||
* by those markers.
|
||||
* A Board of marker has a single world coordinate system which is defined by the board layout.
|
||||
* The returned transformation is the one that transforms points from the board coordinate system
|
||||
* to the camera coordinate system.
|
||||
* Input markers that are not included in the board layout are ignored.
|
||||
* The function returns the number of markers from the input employed for the board pose estimation.
|
||||
* Note that returning a 0 means the pose has not been estimated.
|
||||
*/
|
||||
CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, const Ptr<Board> &board,
|
||||
InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec,
|
||||
OutputArray tvec, bool useExtrinsicGuess = false);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Refind not detected markers based on the already detected and the board layout
|
||||
*
|
||||
* @param image input image
|
||||
* @param board layout of markers in the board.
|
||||
* @param detectedCorners vector of already detected marker corners.
|
||||
* @param detectedIds vector of already detected marker identifiers.
|
||||
* @param rejectedCorners vector of rejected candidates during the marker detection process.
|
||||
* @param cameraMatrix optional input 3x3 floating-point camera matrix
|
||||
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
|
||||
* @param distCoeffs optional vector of distortion coefficients
|
||||
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
|
||||
* @param minRepDistance minimum distance between the corners of the rejected candidate and the
|
||||
* reprojected marker in order to consider it as a correspondence.
|
||||
* @param errorCorrectionRate rate of allowed erroneous bits respect to the error correction
|
||||
* capability of the used dictionary. -1 ignores the error correction step.
|
||||
* @param checkAllOrders Consider the four posible corner orders in the rejectedCorners array.
|
||||
* If it set to false, only the provided corner order is considered (default true).
|
||||
* @param recoveredIdxs Optional array to returns the indexes of the recovered candidates in the
|
||||
* original rejectedCorners array.
|
||||
* @param parameters marker detection parameters
|
||||
*
|
||||
* This function tries to find markers that were not detected in the basic detecMarkers function.
|
||||
* First, based on the current detected marker and the board layout, the function interpolates
|
||||
* the position of the missing markers. Then it tries to find correspondence between the reprojected
|
||||
* markers and the rejected candidates based on the minRepDistance and errorCorrectionRate
|
||||
* parameters.
|
||||
* If camera parameters and distortion coefficients are provided, missing markers are reprojected
|
||||
* using projectPoint function. If not, missing marker projections are interpolated using global
|
||||
* homography, and all the marker corners in the board must have the same Z coordinate.
|
||||
*/
|
||||
CV_EXPORTS_W void refineDetectedMarkers(
|
||||
InputArray image,const Ptr<Board> &board, InputOutputArrayOfArrays detectedCorners,
|
||||
InputOutputArray detectedIds, InputOutputArrayOfArrays rejectedCorners,
|
||||
InputArray cameraMatrix = noArray(), InputArray distCoeffs = noArray(),
|
||||
float minRepDistance = 10.f, float errorCorrectionRate = 3.f, bool checkAllOrders = true,
|
||||
OutputArray recoveredIdxs = noArray(), const Ptr<DetectorParameters> ¶meters = DetectorParameters::create());
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Draw detected markers in image
|
||||
*
|
||||
* @param image input/output image. It must have 1 or 3 channels. The number of channels is not
|
||||
* altered.
|
||||
* @param corners positions of marker corners on input image.
|
||||
* (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of
|
||||
* this array should be Nx4. The order of the corners should be clockwise.
|
||||
* @param ids vector of identifiers for markers in markersCorners .
|
||||
* Optional, if not provided, ids are not painted.
|
||||
* @param borderColor color of marker borders. Rest of colors (text color and first corner color)
|
||||
* are calculated based on this one to improve visualization.
|
||||
*
|
||||
* Given an array of detected marker corners and its corresponding ids, this functions draws
|
||||
* the markers in the image. The marker borders are painted and the markers identifiers if provided.
|
||||
* Useful for debugging purposes.
|
||||
*/
|
||||
CV_EXPORTS_W void drawDetectedMarkers(InputOutputArray image, InputArrayOfArrays corners,
|
||||
InputArray ids = noArray(),
|
||||
Scalar borderColor = Scalar(0, 255, 0));
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Draw coordinate system axis from pose estimation
|
||||
*
|
||||
* @param image input/output image. It must have 1 or 3 channels. The number of channels is not
|
||||
* altered.
|
||||
* @param cameraMatrix input 3x3 floating-point camera matrix
|
||||
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
|
||||
* @param distCoeffs vector of distortion coefficients
|
||||
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
|
||||
* @param rvec rotation vector of the coordinate system that will be drawn. (@sa Rodrigues).
|
||||
* @param tvec translation vector of the coordinate system that will be drawn.
|
||||
* @param length length of the painted axis in the same unit than tvec (usually in meters)
|
||||
*
|
||||
* Given the pose estimation of a marker or board, this function draws the axis of the world
|
||||
* coordinate system, i.e. the system centered on the marker/board. Useful for debugging purposes.
|
||||
*
|
||||
* @deprecated use cv::drawFrameAxes
|
||||
*/
|
||||
CV_EXPORTS_W void drawAxis(InputOutputArray image, InputArray cameraMatrix, InputArray distCoeffs,
|
||||
InputArray rvec, InputArray tvec, float length);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Draw a canonical marker image
|
||||
*
|
||||
* @param dictionary dictionary of markers indicating the type of markers
|
||||
* @param id identifier of the marker that will be returned. It has to be a valid id
|
||||
* in the specified dictionary.
|
||||
* @param sidePixels size of the image in pixels
|
||||
* @param img output image with the marker
|
||||
* @param borderBits width of the marker border.
|
||||
*
|
||||
* This function returns a marker image in its canonical form (i.e. ready to be printed)
|
||||
*/
|
||||
CV_EXPORTS_W void drawMarker(const Ptr<Dictionary> &dictionary, int id, int sidePixels, OutputArray img,
|
||||
int borderBits = 1);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Draw a planar board
|
||||
* @sa _drawPlanarBoardImpl
|
||||
*
|
||||
* @param board layout of the board that will be drawn. The board should be planar,
|
||||
* z coordinate is ignored
|
||||
* @param outSize size of the output image in pixels.
|
||||
* @param img output image with the board. The size of this image will be outSize
|
||||
* and the board will be on the center, keeping the board proportions.
|
||||
* @param marginSize minimum margins (in pixels) of the board in the output image
|
||||
* @param borderBits width of the marker borders.
|
||||
*
|
||||
* This function return the image of a planar board, ready to be printed. It assumes
|
||||
* the Board layout specified is planar by ignoring the z coordinates of the object points.
|
||||
*/
|
||||
CV_EXPORTS_W void drawPlanarBoard(const Ptr<Board> &board, Size outSize, OutputArray img,
|
||||
int marginSize = 0, int borderBits = 1);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Implementation of drawPlanarBoard that accepts a raw Board pointer.
|
||||
*/
|
||||
void _drawPlanarBoardImpl(Board *board, Size outSize, OutputArray img,
|
||||
int marginSize = 0, int borderBits = 1);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Calibrate a camera using aruco markers
|
||||
*
|
||||
* @param corners vector of detected marker corners in all frames.
|
||||
* The corners should have the same format returned by detectMarkers (see #detectMarkers).
|
||||
* @param ids list of identifiers for each marker in corners
|
||||
* @param counter number of markers in each frame so that corners and ids can be split
|
||||
* @param board Marker Board layout
|
||||
* @param imageSize Size of the image used only to initialize the intrinsic camera matrix.
|
||||
* @param cameraMatrix Output 3x3 floating-point camera matrix
|
||||
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . If CV\_CALIB\_USE\_INTRINSIC\_GUESS
|
||||
* and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be
|
||||
* initialized before calling the function.
|
||||
* @param distCoeffs Output vector of distortion coefficients
|
||||
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
|
||||
* @param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each board view
|
||||
* (e.g. std::vector<cv::Mat>>). That is, each k-th rotation vector together with the corresponding
|
||||
* k-th translation vector (see the next output parameter description) brings the board pattern
|
||||
* from the model coordinate space (in which object points are specified) to the world coordinate
|
||||
* space, that is, a real position of the board pattern in the k-th pattern view (k=0.. *M* -1).
|
||||
* @param tvecs Output vector of translation vectors estimated for each pattern view.
|
||||
* @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic parameters.
|
||||
* Order of deviations values:
|
||||
* \f$(f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3,
|
||||
* s_4, \tau_x, \tau_y)\f$ If one of parameters is not estimated, it's deviation is equals to zero.
|
||||
* @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic parameters.
|
||||
* Order of deviations values: \f$(R_1, T_1, \dotsc , R_M, T_M)\f$ where M is number of pattern views,
|
||||
* \f$R_i, T_i\f$ are concatenated 1x3 vectors.
|
||||
* @param perViewErrors Output vector of average re-projection errors estimated for each pattern view.
|
||||
* @param flags flags Different flags for the calibration process (see #calibrateCamera for details).
|
||||
* @param criteria Termination criteria for the iterative optimization algorithm.
|
||||
*
|
||||
* This function calibrates a camera using an Aruco Board. The function receives a list of
|
||||
* detected markers from several views of the Board. The process is similar to the chessboard
|
||||
* calibration in calibrateCamera(). The function returns the final re-projection error.
|
||||
*/
|
||||
CV_EXPORTS_AS(calibrateCameraArucoExtended) double calibrateCameraAruco(
|
||||
InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr<Board> &board,
|
||||
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
|
||||
OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
|
||||
OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics,
|
||||
OutputArray perViewErrors, int flags = 0,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
|
||||
|
||||
|
||||
/** @brief It's the same function as #calibrateCameraAruco but without calibration error estimation.
|
||||
*/
|
||||
CV_EXPORTS_W double calibrateCameraAruco(
|
||||
InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr<Board> &board,
|
||||
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
|
||||
OutputArrayOfArrays rvecs = noArray(), OutputArrayOfArrays tvecs = noArray(), int flags = 0,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
|
||||
|
||||
|
||||
/**
|
||||
* @brief Given a board configuration and a set of detected markers, returns the corresponding
|
||||
* image points and object points to call solvePnP
|
||||
*
|
||||
* @param board Marker board layout.
|
||||
* @param detectedCorners List of detected marker corners of the board.
|
||||
* @param detectedIds List of identifiers for each marker.
|
||||
* @param objPoints Vector of vectors of board marker points in the board coordinate space.
|
||||
* @param imgPoints Vector of vectors of the projections of board marker corner points.
|
||||
*/
|
||||
CV_EXPORTS_W void getBoardObjectAndImagePoints(const Ptr<Board> &board, InputArrayOfArrays detectedCorners,
|
||||
InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints);
|
||||
|
||||
|
||||
//! @}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
354
3rdparty/include/opencv2/aruco/charuco.hpp
vendored
Normal file
354
3rdparty/include/opencv2/aruco/charuco.hpp
vendored
Normal file
@@ -0,0 +1,354 @@
|
||||
/*
|
||||
By downloading, copying, installing or using the software you agree to this
|
||||
license. If you do not agree to this license, do not download, install,
|
||||
copy or use the software.
|
||||
|
||||
License Agreement
|
||||
For Open Source Computer Vision Library
|
||||
(3-clause BSD License)
|
||||
|
||||
Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||
Third party copyrights are property of their respective owners.
|
||||
|
||||
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 names of the copyright holders nor the names of the 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 copyright holders 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.
|
||||
*/
|
||||
|
||||
#ifndef __OPENCV_CHARUCO_HPP__
|
||||
#define __OPENCV_CHARUCO_HPP__
|
||||
|
||||
#include <opencv2/core.hpp>
|
||||
#include <vector>
|
||||
#include <opencv2/aruco.hpp>
|
||||
|
||||
|
||||
namespace cv {
|
||||
namespace aruco {
|
||||
|
||||
//! @addtogroup aruco
|
||||
//! @{
|
||||
|
||||
|
||||
/**
|
||||
* @brief ChArUco board
|
||||
* Specific class for ChArUco boards. A ChArUco board is a planar board where the markers are placed
|
||||
* inside the white squares of a chessboard. The benefits of ChArUco boards is that they provide
|
||||
* both, ArUco markers versatility and chessboard corner precision, which is important for
|
||||
* calibration and pose estimation.
|
||||
* This class also allows the easy creation and drawing of ChArUco boards.
|
||||
*/
|
||||
class CV_EXPORTS_W CharucoBoard : public Board {
|
||||
|
||||
public:
|
||||
// vector of chessboard 3D corners precalculated
|
||||
CV_PROP std::vector< Point3f > chessboardCorners;
|
||||
|
||||
// for each charuco corner, nearest marker id and nearest marker corner id of each marker
|
||||
CV_PROP std::vector< std::vector< int > > nearestMarkerIdx;
|
||||
CV_PROP std::vector< std::vector< int > > nearestMarkerCorners;
|
||||
|
||||
/**
|
||||
* @brief Draw a ChArUco board
|
||||
*
|
||||
* @param outSize size of the output image in pixels.
|
||||
* @param img output image with the board. The size of this image will be outSize
|
||||
* and the board will be on the center, keeping the board proportions.
|
||||
* @param marginSize minimum margins (in pixels) of the board in the output image
|
||||
* @param borderBits width of the marker borders.
|
||||
*
|
||||
* This function return the image of the ChArUco board, ready to be printed.
|
||||
*/
|
||||
CV_WRAP void draw(Size outSize, OutputArray img, int marginSize = 0, int borderBits = 1);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Create a CharucoBoard object
|
||||
*
|
||||
* @param squaresX number of chessboard squares in X direction
|
||||
* @param squaresY number of chessboard squares in Y direction
|
||||
* @param squareLength chessboard square side length (normally in meters)
|
||||
* @param markerLength marker side length (same unit than squareLength)
|
||||
* @param dictionary dictionary of markers indicating the type of markers.
|
||||
* The first markers in the dictionary are used to fill the white chessboard squares.
|
||||
* @return the output CharucoBoard object
|
||||
*
|
||||
* This functions creates a CharucoBoard object given the number of squares in each direction
|
||||
* and the size of the markers and chessboard squares.
|
||||
*/
|
||||
CV_WRAP static Ptr<CharucoBoard> create(int squaresX, int squaresY, float squareLength,
|
||||
float markerLength, const Ptr<Dictionary> &dictionary);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
CV_WRAP Size getChessboardSize() const { return Size(_squaresX, _squaresY); }
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
CV_WRAP float getSquareLength() const { return _squareLength; }
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
CV_WRAP float getMarkerLength() const { return _markerLength; }
|
||||
|
||||
private:
|
||||
void _getNearestMarkerCorners();
|
||||
|
||||
// number of markers in X and Y directions
|
||||
int _squaresX, _squaresY;
|
||||
|
||||
// size of chessboard squares side (normally in meters)
|
||||
float _squareLength;
|
||||
|
||||
// marker side length (normally in meters)
|
||||
float _markerLength;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Interpolate position of ChArUco board corners
|
||||
* @param markerCorners vector of already detected markers corners. For each marker, its four
|
||||
* corners are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the
|
||||
* dimensions of this array should be Nx4. The order of the corners should be clockwise.
|
||||
* @param markerIds list of identifiers for each marker in corners
|
||||
* @param image input image necesary for corner refinement. Note that markers are not detected and
|
||||
* should be sent in corners and ids parameters.
|
||||
* @param board layout of ChArUco board.
|
||||
* @param charucoCorners interpolated chessboard corners
|
||||
* @param charucoIds interpolated chessboard corners identifiers
|
||||
* @param cameraMatrix optional 3x3 floating-point camera matrix
|
||||
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
|
||||
* @param distCoeffs optional vector of distortion coefficients
|
||||
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
|
||||
* @param minMarkers number of adjacent markers that must be detected to return a charuco corner
|
||||
*
|
||||
* This function receives the detected markers and returns the 2D position of the chessboard corners
|
||||
* from a ChArUco board using the detected Aruco markers. If camera parameters are provided,
|
||||
* the process is based in an approximated pose estimation, else it is based on local homography.
|
||||
* Only visible corners are returned. For each corner, its corresponding identifier is
|
||||
* also returned in charucoIds.
|
||||
* The function returns the number of interpolated corners.
|
||||
*/
|
||||
CV_EXPORTS_W int interpolateCornersCharuco(InputArrayOfArrays markerCorners, InputArray markerIds,
|
||||
InputArray image, const Ptr<CharucoBoard> &board,
|
||||
OutputArray charucoCorners, OutputArray charucoIds,
|
||||
InputArray cameraMatrix = noArray(),
|
||||
InputArray distCoeffs = noArray(), int minMarkers = 2);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pose estimation for a ChArUco board given some of their corners
|
||||
* @param charucoCorners vector of detected charuco corners
|
||||
* @param charucoIds list of identifiers for each corner in charucoCorners
|
||||
* @param board layout of ChArUco board.
|
||||
* @param cameraMatrix input 3x3 floating-point camera matrix
|
||||
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
|
||||
* @param distCoeffs vector of distortion coefficients
|
||||
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
|
||||
* @param rvec Output vector (e.g. cv::Mat) corresponding to the rotation vector of the board
|
||||
* (see cv::Rodrigues).
|
||||
* @param tvec Output vector (e.g. cv::Mat) corresponding to the translation vector of the board.
|
||||
* @param useExtrinsicGuess defines whether initial guess for \b rvec and \b tvec will be used or not.
|
||||
*
|
||||
* This function estimates a Charuco board pose from some detected corners.
|
||||
* The function checks if the input corners are enough and valid to perform pose estimation.
|
||||
* If pose estimation is valid, returns true, else returns false.
|
||||
*/
|
||||
CV_EXPORTS_W bool estimatePoseCharucoBoard(InputArray charucoCorners, InputArray charucoIds,
|
||||
const Ptr<CharucoBoard> &board, InputArray cameraMatrix,
|
||||
InputArray distCoeffs, OutputArray rvec, OutputArray tvec,
|
||||
bool useExtrinsicGuess = false);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Draws a set of Charuco corners
|
||||
* @param image input/output image. It must have 1 or 3 channels. The number of channels is not
|
||||
* altered.
|
||||
* @param charucoCorners vector of detected charuco corners
|
||||
* @param charucoIds list of identifiers for each corner in charucoCorners
|
||||
* @param cornerColor color of the square surrounding each corner
|
||||
*
|
||||
* This function draws a set of detected Charuco corners. If identifiers vector is provided, it also
|
||||
* draws the id of each corner.
|
||||
*/
|
||||
CV_EXPORTS_W void drawDetectedCornersCharuco(InputOutputArray image, InputArray charucoCorners,
|
||||
InputArray charucoIds = noArray(),
|
||||
Scalar cornerColor = Scalar(255, 0, 0));
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Calibrate a camera using Charuco corners
|
||||
*
|
||||
* @param charucoCorners vector of detected charuco corners per frame
|
||||
* @param charucoIds list of identifiers for each corner in charucoCorners per frame
|
||||
* @param board Marker Board layout
|
||||
* @param imageSize input image size
|
||||
* @param cameraMatrix Output 3x3 floating-point camera matrix
|
||||
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . If CV\_CALIB\_USE\_INTRINSIC\_GUESS
|
||||
* and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be
|
||||
* initialized before calling the function.
|
||||
* @param distCoeffs Output vector of distortion coefficients
|
||||
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
|
||||
* @param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each board view
|
||||
* (e.g. std::vector<cv::Mat>>). That is, each k-th rotation vector together with the corresponding
|
||||
* k-th translation vector (see the next output parameter description) brings the board pattern
|
||||
* from the model coordinate space (in which object points are specified) to the world coordinate
|
||||
* space, that is, a real position of the board pattern in the k-th pattern view (k=0.. *M* -1).
|
||||
* @param tvecs Output vector of translation vectors estimated for each pattern view.
|
||||
* @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic parameters.
|
||||
* Order of deviations values:
|
||||
* \f$(f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3,
|
||||
* s_4, \tau_x, \tau_y)\f$ If one of parameters is not estimated, it's deviation is equals to zero.
|
||||
* @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic parameters.
|
||||
* Order of deviations values: \f$(R_1, T_1, \dotsc , R_M, T_M)\f$ where M is number of pattern views,
|
||||
* \f$R_i, T_i\f$ are concatenated 1x3 vectors.
|
||||
* @param perViewErrors Output vector of average re-projection errors estimated for each pattern view.
|
||||
* @param flags flags Different flags for the calibration process (see #calibrateCamera for details).
|
||||
* @param criteria Termination criteria for the iterative optimization algorithm.
|
||||
*
|
||||
* This function calibrates a camera using a set of corners of a Charuco Board. The function
|
||||
* receives a list of detected corners and its identifiers from several views of the Board.
|
||||
* The function returns the final re-projection error.
|
||||
*/
|
||||
CV_EXPORTS_AS(calibrateCameraCharucoExtended) double calibrateCameraCharuco(
|
||||
InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, const Ptr<CharucoBoard> &board,
|
||||
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
|
||||
OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
|
||||
OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics,
|
||||
OutputArray perViewErrors, int flags = 0,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
|
||||
|
||||
/** @brief It's the same function as #calibrateCameraCharuco but without calibration error estimation.
|
||||
*/
|
||||
CV_EXPORTS_W double calibrateCameraCharuco(
|
||||
InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, const Ptr<CharucoBoard> &board,
|
||||
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
|
||||
OutputArrayOfArrays rvecs = noArray(), OutputArrayOfArrays tvecs = noArray(), int flags = 0,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Detect ChArUco Diamond markers
|
||||
*
|
||||
* @param image input image necessary for corner subpixel.
|
||||
* @param markerCorners list of detected marker corners from detectMarkers function.
|
||||
* @param markerIds list of marker ids in markerCorners.
|
||||
* @param squareMarkerLengthRate rate between square and marker length:
|
||||
* squareMarkerLengthRate = squareLength/markerLength. The real units are not necessary.
|
||||
* @param diamondCorners output list of detected diamond corners (4 corners per diamond). The order
|
||||
* is the same than in marker corners: top left, top right, bottom right and bottom left. Similar
|
||||
* format than the corners returned by detectMarkers (e.g std::vector<std::vector<cv::Point2f> > ).
|
||||
* @param diamondIds ids of the diamonds in diamondCorners. The id of each diamond is in fact of
|
||||
* type Vec4i, so each diamond has 4 ids, which are the ids of the aruco markers composing the
|
||||
* diamond.
|
||||
* @param cameraMatrix Optional camera calibration matrix.
|
||||
* @param distCoeffs Optional camera distortion coefficients.
|
||||
*
|
||||
* This function detects Diamond markers from the previous detected ArUco markers. The diamonds
|
||||
* are returned in the diamondCorners and diamondIds parameters. If camera calibration parameters
|
||||
* are provided, the diamond search is based on reprojection. If not, diamond search is based on
|
||||
* homography. Homography is faster than reprojection but can slightly reduce the detection rate.
|
||||
*/
|
||||
CV_EXPORTS_W void detectCharucoDiamond(InputArray image, InputArrayOfArrays markerCorners,
|
||||
InputArray markerIds, float squareMarkerLengthRate,
|
||||
OutputArrayOfArrays diamondCorners, OutputArray diamondIds,
|
||||
InputArray cameraMatrix = noArray(),
|
||||
InputArray distCoeffs = noArray());
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Draw a set of detected ChArUco Diamond markers
|
||||
*
|
||||
* @param image input/output image. It must have 1 or 3 channels. The number of channels is not
|
||||
* altered.
|
||||
* @param diamondCorners positions of diamond corners in the same format returned by
|
||||
* detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers,
|
||||
* the dimensions of this array should be Nx4. The order of the corners should be clockwise.
|
||||
* @param diamondIds vector of identifiers for diamonds in diamondCorners, in the same format
|
||||
* returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>).
|
||||
* Optional, if not provided, ids are not painted.
|
||||
* @param borderColor color of marker borders. Rest of colors (text color and first corner color)
|
||||
* are calculated based on this one.
|
||||
*
|
||||
* Given an array of detected diamonds, this functions draws them in the image. The marker borders
|
||||
* are painted and the markers identifiers if provided.
|
||||
* Useful for debugging purposes.
|
||||
*/
|
||||
CV_EXPORTS_W void drawDetectedDiamonds(InputOutputArray image, InputArrayOfArrays diamondCorners,
|
||||
InputArray diamondIds = noArray(),
|
||||
Scalar borderColor = Scalar(0, 0, 255));
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Draw a ChArUco Diamond marker
|
||||
*
|
||||
* @param dictionary dictionary of markers indicating the type of markers.
|
||||
* @param ids list of 4 ids for each ArUco marker in the ChArUco marker.
|
||||
* @param squareLength size of the chessboard squares in pixels.
|
||||
* @param markerLength size of the markers in pixels.
|
||||
* @param img output image with the marker. The size of this image will be
|
||||
* 3*squareLength + 2*marginSize,.
|
||||
* @param marginSize minimum margins (in pixels) of the marker in the output image
|
||||
* @param borderBits width of the marker borders.
|
||||
*
|
||||
* This function return the image of a ChArUco marker, ready to be printed.
|
||||
*/
|
||||
// TODO cannot be exported yet; conversion from/to Vec4i is not wrapped in core
|
||||
CV_EXPORTS void drawCharucoDiamond(const Ptr<Dictionary> &dictionary, Vec4i ids, int squareLength,
|
||||
int markerLength, OutputArray img, int marginSize = 0,
|
||||
int borderBits = 1);
|
||||
|
||||
|
||||
/**
|
||||
* @brief test whether the ChArUco markers are collinear
|
||||
*
|
||||
* @param _board layout of ChArUco board.
|
||||
* @param _charucoIds list of identifiers for each corner in charucoCorners per frame.
|
||||
* @return bool value, 1 (true) if detected corners form a line, 0 (false) if they do not.
|
||||
solvePnP, calibration functions will fail if the corners are collinear (true).
|
||||
*
|
||||
* The number of ids in charucoIDs should be <= the number of chessboard corners in the board. This functions checks whether the charuco corners are on a straight line (returns true, if so), or not (false). Axis parallel, as well as diagonal and other straight lines detected. Degenerate cases: for number of charucoIDs <= 2, the function returns true.
|
||||
*/
|
||||
CV_EXPORTS_W bool testCharucoCornersCollinear(const Ptr<CharucoBoard> &_board,
|
||||
InputArray _charucoIds);
|
||||
|
||||
//! @}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
212
3rdparty/include/opencv2/aruco/dictionary.hpp
vendored
Normal file
212
3rdparty/include/opencv2/aruco/dictionary.hpp
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
By downloading, copying, installing or using the software you agree to this
|
||||
license. If you do not agree to this license, do not download, install,
|
||||
copy or use the software.
|
||||
|
||||
License Agreement
|
||||
For Open Source Computer Vision Library
|
||||
(3-clause BSD License)
|
||||
|
||||
Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||
Third party copyrights are property of their respective owners.
|
||||
|
||||
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 names of the copyright holders nor the names of the 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 copyright holders 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.
|
||||
*/
|
||||
|
||||
#ifndef __OPENCV_DICTIONARY_HPP__
|
||||
#define __OPENCV_DICTIONARY_HPP__
|
||||
|
||||
#include <opencv2/core.hpp>
|
||||
|
||||
namespace cv {
|
||||
namespace aruco {
|
||||
|
||||
//! @addtogroup aruco
|
||||
//! @{
|
||||
|
||||
|
||||
/**
|
||||
* @brief Dictionary/Set of markers. It contains the inner codification
|
||||
*
|
||||
* bytesList contains the marker codewords where
|
||||
* - bytesList.rows is the dictionary size
|
||||
* - each marker is encoded using `nbytes = ceil(markerSize*markerSize/8.)`
|
||||
* - each row contains all 4 rotations of the marker, so its length is `4*nbytes`
|
||||
*
|
||||
* `bytesList.ptr(i)[k*nbytes + j]` is then the j-th byte of i-th marker, in its k-th rotation.
|
||||
*/
|
||||
class CV_EXPORTS_W Dictionary {
|
||||
|
||||
public:
|
||||
CV_PROP_RW Mat bytesList; // marker code information
|
||||
CV_PROP_RW int markerSize; // number of bits per dimension
|
||||
CV_PROP_RW int maxCorrectionBits; // maximum number of bits that can be corrected
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
Dictionary(const Mat &_bytesList = Mat(), int _markerSize = 0, int _maxcorr = 0);
|
||||
|
||||
|
||||
/**
|
||||
Dictionary(const Dictionary &_dictionary);
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
Dictionary(const Ptr<Dictionary> &_dictionary);
|
||||
|
||||
|
||||
/**
|
||||
* @see generateCustomDictionary
|
||||
*/
|
||||
CV_WRAP_AS(create) static Ptr<Dictionary> create(int nMarkers, int markerSize, int randomSeed=0);
|
||||
|
||||
|
||||
/**
|
||||
* @see generateCustomDictionary
|
||||
*/
|
||||
CV_WRAP_AS(create_from) static Ptr<Dictionary> create(int nMarkers, int markerSize,
|
||||
const Ptr<Dictionary> &baseDictionary, int randomSeed=0);
|
||||
|
||||
/**
|
||||
* @see getPredefinedDictionary
|
||||
*/
|
||||
CV_WRAP static Ptr<Dictionary> get(int dict);
|
||||
|
||||
/**
|
||||
* @brief Given a matrix of bits. Returns whether if marker is identified or not.
|
||||
* It returns by reference the correct id (if any) and the correct rotation
|
||||
*/
|
||||
bool identify(const Mat &onlyBits, int &idx, int &rotation, double maxCorrectionRate) const;
|
||||
|
||||
/**
|
||||
* @brief Returns the distance of the input bits to the specific id. If allRotations is true,
|
||||
* the four posible bits rotation are considered
|
||||
*/
|
||||
int getDistanceToId(InputArray bits, int id, bool allRotations = true) const;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Draw a canonical marker image
|
||||
*/
|
||||
CV_WRAP void drawMarker(int id, int sidePixels, OutputArray _img, int borderBits = 1) const;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Transform matrix of bits to list of bytes in the 4 rotations
|
||||
*/
|
||||
CV_WRAP static Mat getByteListFromBits(const Mat &bits);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Transform list of bytes to matrix of bits
|
||||
*/
|
||||
CV_WRAP static Mat getBitsFromByteList(const Mat &byteList, int markerSize);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Predefined markers dictionaries/sets
|
||||
* Each dictionary indicates the number of bits and the number of markers contained
|
||||
* - DICT_ARUCO_ORIGINAL: standard ArUco Library Markers. 1024 markers, 5x5 bits, 0 minimum
|
||||
distance
|
||||
*/
|
||||
enum PREDEFINED_DICTIONARY_NAME {
|
||||
DICT_4X4_50 = 0,
|
||||
DICT_4X4_100,
|
||||
DICT_4X4_250,
|
||||
DICT_4X4_1000,
|
||||
DICT_5X5_50,
|
||||
DICT_5X5_100,
|
||||
DICT_5X5_250,
|
||||
DICT_5X5_1000,
|
||||
DICT_6X6_50,
|
||||
DICT_6X6_100,
|
||||
DICT_6X6_250,
|
||||
DICT_6X6_1000,
|
||||
DICT_7X7_50,
|
||||
DICT_7X7_100,
|
||||
DICT_7X7_250,
|
||||
DICT_7X7_1000,
|
||||
DICT_ARUCO_ORIGINAL,
|
||||
DICT_APRILTAG_16h5, ///< 4x4 bits, minimum hamming distance between any two codes = 5, 30 codes
|
||||
DICT_APRILTAG_25h9, ///< 5x5 bits, minimum hamming distance between any two codes = 9, 35 codes
|
||||
DICT_APRILTAG_36h10, ///< 6x6 bits, minimum hamming distance between any two codes = 10, 2320 codes
|
||||
DICT_APRILTAG_36h11 ///< 6x6 bits, minimum hamming distance between any two codes = 11, 587 codes
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Returns one of the predefined dictionaries defined in PREDEFINED_DICTIONARY_NAME
|
||||
*/
|
||||
CV_EXPORTS Ptr<Dictionary> getPredefinedDictionary(PREDEFINED_DICTIONARY_NAME name);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Returns one of the predefined dictionaries referenced by DICT_*.
|
||||
*/
|
||||
CV_EXPORTS_W Ptr<Dictionary> getPredefinedDictionary(int dict);
|
||||
|
||||
|
||||
/**
|
||||
* @see generateCustomDictionary
|
||||
*/
|
||||
CV_EXPORTS_AS(custom_dictionary) Ptr<Dictionary> generateCustomDictionary(
|
||||
int nMarkers,
|
||||
int markerSize,
|
||||
int randomSeed=0);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Generates a new customizable marker dictionary
|
||||
*
|
||||
* @param nMarkers number of markers in the dictionary
|
||||
* @param markerSize number of bits per dimension of each markers
|
||||
* @param baseDictionary Include the markers in this dictionary at the beginning (optional)
|
||||
* @param randomSeed a user supplied seed for theRNG()
|
||||
*
|
||||
* This function creates a new dictionary composed by nMarkers markers and each markers composed
|
||||
* by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly
|
||||
* included and the rest are generated based on them. If the size of baseDictionary is higher
|
||||
* than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
|
||||
*/
|
||||
CV_EXPORTS_AS(custom_dictionary_from) Ptr<Dictionary> generateCustomDictionary(
|
||||
int nMarkers,
|
||||
int markerSize,
|
||||
const Ptr<Dictionary> &baseDictionary,
|
||||
int randomSeed=0);
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
380
3rdparty/include/opencv2/bgsegm.hpp
vendored
Normal file
380
3rdparty/include/opencv2/bgsegm.hpp
vendored
Normal file
@@ -0,0 +1,380 @@
|
||||
/*
|
||||
By downloading, copying, installing or using the software you agree to this
|
||||
license. If you do not agree to this license, do not download, install,
|
||||
copy or use the software.
|
||||
|
||||
|
||||
License Agreement
|
||||
For Open Source Computer Vision Library
|
||||
(3-clause BSD License)
|
||||
|
||||
Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||
Third party copyrights are property of their respective owners.
|
||||
|
||||
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 names of the copyright holders nor the names of the 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 copyright holders 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.
|
||||
*/
|
||||
|
||||
#ifndef __OPENCV_BGSEGM_HPP__
|
||||
#define __OPENCV_BGSEGM_HPP__
|
||||
|
||||
#include "opencv2/video.hpp"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/** @defgroup bgsegm Improved Background-Foreground Segmentation Methods
|
||||
*/
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace bgsegm
|
||||
{
|
||||
|
||||
//! @addtogroup bgsegm
|
||||
//! @{
|
||||
|
||||
/** @brief Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
|
||||
|
||||
The class implements the algorithm described in @cite KB2001 .
|
||||
*/
|
||||
class CV_EXPORTS_W BackgroundSubtractorMOG : public BackgroundSubtractor
|
||||
{
|
||||
public:
|
||||
CV_WRAP virtual int getHistory() const = 0;
|
||||
CV_WRAP virtual void setHistory(int nframes) = 0;
|
||||
|
||||
CV_WRAP virtual int getNMixtures() const = 0;
|
||||
CV_WRAP virtual void setNMixtures(int nmix) = 0;
|
||||
|
||||
CV_WRAP virtual double getBackgroundRatio() const = 0;
|
||||
CV_WRAP virtual void setBackgroundRatio(double backgroundRatio) = 0;
|
||||
|
||||
CV_WRAP virtual double getNoiseSigma() const = 0;
|
||||
CV_WRAP virtual void setNoiseSigma(double noiseSigma) = 0;
|
||||
};
|
||||
|
||||
/** @brief Creates mixture-of-gaussian background subtractor
|
||||
|
||||
@param history Length of the history.
|
||||
@param nmixtures Number of Gaussian mixtures.
|
||||
@param backgroundRatio Background ratio.
|
||||
@param noiseSigma Noise strength (standard deviation of the brightness or each color channel). 0
|
||||
means some automatic value.
|
||||
*/
|
||||
CV_EXPORTS_W Ptr<BackgroundSubtractorMOG>
|
||||
createBackgroundSubtractorMOG(int history=200, int nmixtures=5,
|
||||
double backgroundRatio=0.7, double noiseSigma=0);
|
||||
|
||||
|
||||
/** @brief Background Subtractor module based on the algorithm given in @cite Gold2012 .
|
||||
|
||||
Takes a series of images and returns a sequence of mask (8UC1)
|
||||
images of the same size, where 255 indicates Foreground and 0 represents Background.
|
||||
This class implements an algorithm described in "Visual Tracking of Human Visitors under
|
||||
Variable-Lighting Conditions for a Responsive Audio Art Installation," A. Godbehere,
|
||||
A. Matsukawa, K. Goldberg, American Control Conference, Montreal, June 2012.
|
||||
*/
|
||||
class CV_EXPORTS_W BackgroundSubtractorGMG : public BackgroundSubtractor
|
||||
{
|
||||
public:
|
||||
/** @brief Returns total number of distinct colors to maintain in histogram.
|
||||
*/
|
||||
CV_WRAP virtual int getMaxFeatures() const = 0;
|
||||
/** @brief Sets total number of distinct colors to maintain in histogram.
|
||||
*/
|
||||
CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
|
||||
|
||||
/** @brief Returns the learning rate of the algorithm.
|
||||
|
||||
It lies between 0.0 and 1.0. It determines how quickly features are "forgotten" from
|
||||
histograms.
|
||||
*/
|
||||
CV_WRAP virtual double getDefaultLearningRate() const = 0;
|
||||
/** @brief Sets the learning rate of the algorithm.
|
||||
*/
|
||||
CV_WRAP virtual void setDefaultLearningRate(double lr) = 0;
|
||||
|
||||
/** @brief Returns the number of frames used to initialize background model.
|
||||
*/
|
||||
CV_WRAP virtual int getNumFrames() const = 0;
|
||||
/** @brief Sets the number of frames used to initialize background model.
|
||||
*/
|
||||
CV_WRAP virtual void setNumFrames(int nframes) = 0;
|
||||
|
||||
/** @brief Returns the parameter used for quantization of color-space.
|
||||
|
||||
It is the number of discrete levels in each channel to be used in histograms.
|
||||
*/
|
||||
CV_WRAP virtual int getQuantizationLevels() const = 0;
|
||||
/** @brief Sets the parameter used for quantization of color-space
|
||||
*/
|
||||
CV_WRAP virtual void setQuantizationLevels(int nlevels) = 0;
|
||||
|
||||
/** @brief Returns the prior probability that each individual pixel is a background pixel.
|
||||
*/
|
||||
CV_WRAP virtual double getBackgroundPrior() const = 0;
|
||||
/** @brief Sets the prior probability that each individual pixel is a background pixel.
|
||||
*/
|
||||
CV_WRAP virtual void setBackgroundPrior(double bgprior) = 0;
|
||||
|
||||
/** @brief Returns the kernel radius used for morphological operations
|
||||
*/
|
||||
CV_WRAP virtual int getSmoothingRadius() const = 0;
|
||||
/** @brief Sets the kernel radius used for morphological operations
|
||||
*/
|
||||
CV_WRAP virtual void setSmoothingRadius(int radius) = 0;
|
||||
|
||||
/** @brief Returns the value of decision threshold.
|
||||
|
||||
Decision value is the value above which pixel is determined to be FG.
|
||||
*/
|
||||
CV_WRAP virtual double getDecisionThreshold() const = 0;
|
||||
/** @brief Sets the value of decision threshold.
|
||||
*/
|
||||
CV_WRAP virtual void setDecisionThreshold(double thresh) = 0;
|
||||
|
||||
/** @brief Returns the status of background model update
|
||||
*/
|
||||
CV_WRAP virtual bool getUpdateBackgroundModel() const = 0;
|
||||
/** @brief Sets the status of background model update
|
||||
*/
|
||||
CV_WRAP virtual void setUpdateBackgroundModel(bool update) = 0;
|
||||
|
||||
/** @brief Returns the minimum value taken on by pixels in image sequence. Usually 0.
|
||||
*/
|
||||
CV_WRAP virtual double getMinVal() const = 0;
|
||||
/** @brief Sets the minimum value taken on by pixels in image sequence.
|
||||
*/
|
||||
CV_WRAP virtual void setMinVal(double val) = 0;
|
||||
|
||||
/** @brief Returns the maximum value taken on by pixels in image sequence. e.g. 1.0 or 255.
|
||||
*/
|
||||
CV_WRAP virtual double getMaxVal() const = 0;
|
||||
/** @brief Sets the maximum value taken on by pixels in image sequence.
|
||||
*/
|
||||
CV_WRAP virtual void setMaxVal(double val) = 0;
|
||||
};
|
||||
|
||||
/** @brief Creates a GMG Background Subtractor
|
||||
|
||||
@param initializationFrames number of frames used to initialize the background models.
|
||||
@param decisionThreshold Threshold value, above which it is marked foreground, else background.
|
||||
*/
|
||||
CV_EXPORTS_W Ptr<BackgroundSubtractorGMG> createBackgroundSubtractorGMG(int initializationFrames=120,
|
||||
double decisionThreshold=0.8);
|
||||
|
||||
/** @brief Background subtraction based on counting.
|
||||
|
||||
About as fast as MOG2 on a high end system.
|
||||
More than twice faster than MOG2 on cheap hardware (benchmarked on Raspberry Pi3).
|
||||
|
||||
%Algorithm by Sagi Zeevi ( https://github.com/sagi-z/BackgroundSubtractorCNT )
|
||||
*/
|
||||
class CV_EXPORTS_W BackgroundSubtractorCNT : public BackgroundSubtractor
|
||||
{
|
||||
public:
|
||||
// BackgroundSubtractor interface
|
||||
CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE = 0;
|
||||
CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE = 0;
|
||||
|
||||
/** @brief Returns number of frames with same pixel color to consider stable.
|
||||
*/
|
||||
CV_WRAP virtual int getMinPixelStability() const = 0;
|
||||
/** @brief Sets the number of frames with same pixel color to consider stable.
|
||||
*/
|
||||
CV_WRAP virtual void setMinPixelStability(int value) = 0;
|
||||
|
||||
/** @brief Returns maximum allowed credit for a pixel in history.
|
||||
*/
|
||||
CV_WRAP virtual int getMaxPixelStability() const = 0;
|
||||
/** @brief Sets the maximum allowed credit for a pixel in history.
|
||||
*/
|
||||
CV_WRAP virtual void setMaxPixelStability(int value) = 0;
|
||||
|
||||
/** @brief Returns if we're giving a pixel credit for being stable for a long time.
|
||||
*/
|
||||
CV_WRAP virtual bool getUseHistory() const = 0;
|
||||
/** @brief Sets if we're giving a pixel credit for being stable for a long time.
|
||||
*/
|
||||
CV_WRAP virtual void setUseHistory(bool value) = 0;
|
||||
|
||||
/** @brief Returns if we're parallelizing the algorithm.
|
||||
*/
|
||||
CV_WRAP virtual bool getIsParallel() const = 0;
|
||||
/** @brief Sets if we're parallelizing the algorithm.
|
||||
*/
|
||||
CV_WRAP virtual void setIsParallel(bool value) = 0;
|
||||
};
|
||||
|
||||
/** @brief Creates a CNT Background Subtractor
|
||||
|
||||
@param minPixelStability number of frames with same pixel color to consider stable
|
||||
@param useHistory determines if we're giving a pixel credit for being stable for a long time
|
||||
@param maxPixelStability maximum allowed credit for a pixel in history
|
||||
@param isParallel determines if we're parallelizing the algorithm
|
||||
*/
|
||||
|
||||
CV_EXPORTS_W Ptr<BackgroundSubtractorCNT>
|
||||
createBackgroundSubtractorCNT(int minPixelStability = 15,
|
||||
bool useHistory = true,
|
||||
int maxPixelStability = 15*60,
|
||||
bool isParallel = true);
|
||||
|
||||
enum LSBPCameraMotionCompensation {
|
||||
LSBP_CAMERA_MOTION_COMPENSATION_NONE = 0,
|
||||
LSBP_CAMERA_MOTION_COMPENSATION_LK
|
||||
};
|
||||
|
||||
/** @brief Implementation of the different yet better algorithm which is called GSOC, as it was implemented during GSOC and was not originated from any paper.
|
||||
|
||||
This algorithm demonstrates better performance on CDNET 2014 dataset compared to other algorithms in OpenCV.
|
||||
*/
|
||||
class CV_EXPORTS_W BackgroundSubtractorGSOC : public BackgroundSubtractor
|
||||
{
|
||||
public:
|
||||
// BackgroundSubtractor interface
|
||||
CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE = 0;
|
||||
|
||||
CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE = 0;
|
||||
};
|
||||
|
||||
/** @brief Background Subtraction using Local SVD Binary Pattern. More details about the algorithm can be found at @cite LGuo2016
|
||||
*/
|
||||
class CV_EXPORTS_W BackgroundSubtractorLSBP : public BackgroundSubtractor
|
||||
{
|
||||
public:
|
||||
// BackgroundSubtractor interface
|
||||
CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE = 0;
|
||||
|
||||
CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE = 0;
|
||||
};
|
||||
|
||||
/** @brief This is for calculation of the LSBP descriptors.
|
||||
*/
|
||||
class CV_EXPORTS_W BackgroundSubtractorLSBPDesc
|
||||
{
|
||||
public:
|
||||
static void calcLocalSVDValues(OutputArray localSVDValues, const Mat& frame);
|
||||
|
||||
static void computeFromLocalSVDValues(OutputArray desc, const Mat& localSVDValues, const Point2i* LSBPSamplePoints);
|
||||
|
||||
static void compute(OutputArray desc, const Mat& frame, const Point2i* LSBPSamplePoints);
|
||||
};
|
||||
|
||||
/** @brief Creates an instance of BackgroundSubtractorGSOC algorithm.
|
||||
|
||||
Implementation of the different yet better algorithm which is called GSOC, as it was implemented during GSOC and was not originated from any paper.
|
||||
|
||||
@param mc Whether to use camera motion compensation.
|
||||
@param nSamples Number of samples to maintain at each point of the frame.
|
||||
@param replaceRate Probability of replacing the old sample - how fast the model will update itself.
|
||||
@param propagationRate Probability of propagating to neighbors.
|
||||
@param hitsThreshold How many positives the sample must get before it will be considered as a possible replacement.
|
||||
@param alpha Scale coefficient for threshold.
|
||||
@param beta Bias coefficient for threshold.
|
||||
@param blinkingSupressionDecay Blinking supression decay factor.
|
||||
@param blinkingSupressionMultiplier Blinking supression multiplier.
|
||||
@param noiseRemovalThresholdFacBG Strength of the noise removal for background points.
|
||||
@param noiseRemovalThresholdFacFG Strength of the noise removal for foreground points.
|
||||
*/
|
||||
CV_EXPORTS_W Ptr<BackgroundSubtractorGSOC> createBackgroundSubtractorGSOC(int mc = LSBP_CAMERA_MOTION_COMPENSATION_NONE, int nSamples = 20, float replaceRate = 0.003f, float propagationRate = 0.01f, int hitsThreshold = 32, float alpha = 0.01f, float beta = 0.0022f, float blinkingSupressionDecay = 0.1f, float blinkingSupressionMultiplier = 0.1f, float noiseRemovalThresholdFacBG = 0.0004f, float noiseRemovalThresholdFacFG = 0.0008f);
|
||||
|
||||
/** @brief Creates an instance of BackgroundSubtractorLSBP algorithm.
|
||||
|
||||
Background Subtraction using Local SVD Binary Pattern. More details about the algorithm can be found at @cite LGuo2016
|
||||
|
||||
@param mc Whether to use camera motion compensation.
|
||||
@param nSamples Number of samples to maintain at each point of the frame.
|
||||
@param LSBPRadius LSBP descriptor radius.
|
||||
@param Tlower Lower bound for T-values. See @cite LGuo2016 for details.
|
||||
@param Tupper Upper bound for T-values. See @cite LGuo2016 for details.
|
||||
@param Tinc Increase step for T-values. See @cite LGuo2016 for details.
|
||||
@param Tdec Decrease step for T-values. See @cite LGuo2016 for details.
|
||||
@param Rscale Scale coefficient for threshold values.
|
||||
@param Rincdec Increase/Decrease step for threshold values.
|
||||
@param noiseRemovalThresholdFacBG Strength of the noise removal for background points.
|
||||
@param noiseRemovalThresholdFacFG Strength of the noise removal for foreground points.
|
||||
@param LSBPthreshold Threshold for LSBP binary string.
|
||||
@param minCount Minimal number of matches for sample to be considered as foreground.
|
||||
*/
|
||||
CV_EXPORTS_W Ptr<BackgroundSubtractorLSBP> createBackgroundSubtractorLSBP(int mc = LSBP_CAMERA_MOTION_COMPENSATION_NONE, int nSamples = 20, int LSBPRadius = 16, float Tlower = 2.0f, float Tupper = 32.0f, float Tinc = 1.0f, float Tdec = 0.05f, float Rscale = 10.0f, float Rincdec = 0.005f, float noiseRemovalThresholdFacBG = 0.0004f, float noiseRemovalThresholdFacFG = 0.0008f, int LSBPthreshold = 8, int minCount = 2);
|
||||
|
||||
/** @brief Synthetic frame sequence generator for testing background subtraction algorithms.
|
||||
|
||||
It will generate the moving object on top of the background.
|
||||
It will apply some distortion to the background to make the test more complex.
|
||||
*/
|
||||
class CV_EXPORTS_W SyntheticSequenceGenerator : public Algorithm
|
||||
{
|
||||
private:
|
||||
const double amplitude;
|
||||
const double wavelength;
|
||||
const double wavespeed;
|
||||
const double objspeed;
|
||||
unsigned timeStep;
|
||||
Point2d pos;
|
||||
Point2d dir;
|
||||
Mat background;
|
||||
Mat object;
|
||||
RNG rng;
|
||||
|
||||
public:
|
||||
/** @brief Creates an instance of SyntheticSequenceGenerator.
|
||||
|
||||
@param background Background image for object.
|
||||
@param object Object image which will move slowly over the background.
|
||||
@param amplitude Amplitude of wave distortion applied to background.
|
||||
@param wavelength Length of waves in distortion applied to background.
|
||||
@param wavespeed How fast waves will move.
|
||||
@param objspeed How fast object will fly over background.
|
||||
*/
|
||||
CV_WRAP SyntheticSequenceGenerator(InputArray background, InputArray object, double amplitude, double wavelength, double wavespeed, double objspeed);
|
||||
|
||||
/** @brief Obtain the next frame in the sequence.
|
||||
|
||||
@param frame Output frame.
|
||||
@param gtMask Output ground-truth (reference) segmentation mask object/background.
|
||||
*/
|
||||
CV_WRAP void getNextFrame(OutputArray frame, OutputArray gtMask);
|
||||
};
|
||||
|
||||
/** @brief Creates an instance of SyntheticSequenceGenerator.
|
||||
|
||||
@param background Background image for object.
|
||||
@param object Object image which will move slowly over the background.
|
||||
@param amplitude Amplitude of wave distortion applied to background.
|
||||
@param wavelength Length of waves in distortion applied to background.
|
||||
@param wavespeed How fast waves will move.
|
||||
@param objspeed How fast object will fly over background.
|
||||
*/
|
||||
CV_EXPORTS_W Ptr<SyntheticSequenceGenerator> createSyntheticSequenceGenerator(InputArray background, InputArray object, double amplitude = 2.0, double wavelength = 20.0, double wavespeed = 0.2, double objspeed = 6.0);
|
||||
|
||||
//! @}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
60
3rdparty/include/opencv2/bioinspired.hpp
vendored
Normal file
60
3rdparty/include/opencv2/bioinspired.hpp
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's 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.
|
||||
//
|
||||
// * The name of the copyright holders may not 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 Intel Corporation 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.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_BIOINSPIRED_HPP__
|
||||
#define __OPENCV_BIOINSPIRED_HPP__
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/bioinspired/retina.hpp"
|
||||
#include "opencv2/bioinspired/retinafasttonemapping.hpp"
|
||||
#include "opencv2/bioinspired/transientareassegmentationmodule.hpp"
|
||||
|
||||
/** @defgroup bioinspired Biologically inspired vision models and derivated tools
|
||||
|
||||
The module provides biological visual systems models (human visual system and others). It also
|
||||
provides derivated objects that take advantage of those bio-inspired models.
|
||||
|
||||
@ref bioinspired_retina
|
||||
|
||||
*/
|
||||
|
||||
#endif
|
||||
48
3rdparty/include/opencv2/bioinspired/bioinspired.hpp
vendored
Normal file
48
3rdparty/include/opencv2/bioinspired/bioinspired.hpp
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's 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.
|
||||
//
|
||||
// * The name of the copyright holders may not 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 Intel Corporation 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.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifdef __OPENCV_BUILD
|
||||
#error this is a compatibility header which should not be used inside the OpenCV library
|
||||
#endif
|
||||
|
||||
#include "opencv2/bioinspired.hpp"
|
||||
454
3rdparty/include/opencv2/bioinspired/retina.hpp
vendored
Normal file
454
3rdparty/include/opencv2/bioinspired/retina.hpp
vendored
Normal file
@@ -0,0 +1,454 @@
|
||||
/*#******************************************************************************
|
||||
** IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
**
|
||||
** By downloading, copying, installing or using the software you agree to this license.
|
||||
** If you do not agree to this license, do not download, install,
|
||||
** copy or use the software.
|
||||
**
|
||||
**
|
||||
** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab.
|
||||
** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping.
|
||||
**
|
||||
** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications)
|
||||
**
|
||||
** Creation - enhancement process 2007-2015
|
||||
** Author: Alexandre Benoit (benoit.alexandre.vision@gmail.com), LISTIC lab, Annecy le vieux, France
|
||||
**
|
||||
** Theses algorithm have been developped by Alexandre BENOIT since his thesis with Alice Caplier at Gipsa-Lab (www.gipsa-lab.inpg.fr) and the research he pursues at LISTIC Lab (www.listic.univ-savoie.fr).
|
||||
** Refer to the following research paper for more information:
|
||||
** Benoit A., Caplier A., Durette B., Herault, J., "USING HUMAN VISUAL SYSTEM MODELING FOR BIO-INSPIRED LOW LEVEL IMAGE PROCESSING", Elsevier, Computer Vision and Image Understanding 114 (2010), pp. 758-773, DOI: http://dx.doi.org/10.1016/j.cviu.2010.01.011
|
||||
** This work have been carried out thanks to Jeanny Herault who's research and great discussions are the basis of all this work, please take a look at his book:
|
||||
** Vision: Images, Signals and Neural Networks: Models of Neural Processing in Visual Perception (Progress in Neural Processing),By: Jeanny Herault, ISBN: 9814273686. WAPI (Tower ID): 113266891.
|
||||
**
|
||||
** The retina filter includes the research contributions of phd/research collegues from which code has been redrawn by the author :
|
||||
** _take a look at the retinacolor.hpp module to discover Brice Chaix de Lavarene color mosaicing/demosaicing and the reference paper:
|
||||
** ====> B. Chaix de Lavarene, D. Alleysson, B. Durette, J. Herault (2007). "Efficient demosaicing through recursive filtering", IEEE International Conference on Image Processing ICIP 2007
|
||||
** _take a look at imagelogpolprojection.hpp to discover retina spatial log sampling which originates from Barthelemy Durette phd with Jeanny Herault. A Retina / V1 cortex projection is also proposed and originates from Jeanny's discussions.
|
||||
** ====> more informations in the above cited Jeanny Heraults's book.
|
||||
**
|
||||
** License Agreement
|
||||
** For Open Source Computer Vision Library
|
||||
**
|
||||
** Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved.
|
||||
**
|
||||
** For Human Visual System tools (bioinspired)
|
||||
** Copyright (C) 2007-2015, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved.
|
||||
**
|
||||
** Third party copyrights are property of their respective owners.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** * The name of the copyright holders may not 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 Intel Corporation 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.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __OPENCV_BIOINSPIRED_RETINA_HPP__
|
||||
#define __OPENCV_BIOINSPIRED_RETINA_HPP__
|
||||
|
||||
/**
|
||||
@file
|
||||
@date Jul 19, 2011
|
||||
@author Alexandre Benoit
|
||||
*/
|
||||
|
||||
#include "opencv2/core.hpp" // for all OpenCV core functionalities access, including cv::Exception support
|
||||
|
||||
|
||||
namespace cv{
|
||||
namespace bioinspired{
|
||||
|
||||
//! @addtogroup bioinspired
|
||||
//! @{
|
||||
|
||||
enum {
|
||||
RETINA_COLOR_RANDOM, //!< each pixel position is either R, G or B in a random choice
|
||||
RETINA_COLOR_DIAGONAL,//!< color sampling is RGBRGBRGB..., line 2 BRGBRGBRG..., line 3, GBRGBRGBR...
|
||||
RETINA_COLOR_BAYER//!< standard bayer sampling
|
||||
};
|
||||
|
||||
|
||||
/** @brief retina model parameters structure
|
||||
|
||||
For better clarity, check explenations on the comments of methods : setupOPLandIPLParvoChannel and setupIPLMagnoChannel
|
||||
|
||||
Here is the default configuration file of the retina module. It gives results such as the first
|
||||
retina output shown on the top of this page.
|
||||
|
||||
@code{xml}
|
||||
<?xml version="1.0"?>
|
||||
<opencv_storage>
|
||||
<OPLandIPLparvo>
|
||||
<colorMode>1</colorMode>
|
||||
<normaliseOutput>1</normaliseOutput>
|
||||
<photoreceptorsLocalAdaptationSensitivity>7.5e-01</photoreceptorsLocalAdaptationSensitivity>
|
||||
<photoreceptorsTemporalConstant>9.0e-01</photoreceptorsTemporalConstant>
|
||||
<photoreceptorsSpatialConstant>5.3e-01</photoreceptorsSpatialConstant>
|
||||
<horizontalCellsGain>0.01</horizontalCellsGain>
|
||||
<hcellsTemporalConstant>0.5</hcellsTemporalConstant>
|
||||
<hcellsSpatialConstant>7.</hcellsSpatialConstant>
|
||||
<ganglionCellsSensitivity>7.5e-01</ganglionCellsSensitivity></OPLandIPLparvo>
|
||||
<IPLmagno>
|
||||
<normaliseOutput>1</normaliseOutput>
|
||||
<parasolCells_beta>0.</parasolCells_beta>
|
||||
<parasolCells_tau>0.</parasolCells_tau>
|
||||
<parasolCells_k>7.</parasolCells_k>
|
||||
<amacrinCellsTemporalCutFrequency>2.0e+00</amacrinCellsTemporalCutFrequency>
|
||||
<V0CompressionParameter>9.5e-01</V0CompressionParameter>
|
||||
<localAdaptintegration_tau>0.</localAdaptintegration_tau>
|
||||
<localAdaptintegration_k>7.</localAdaptintegration_k></IPLmagno>
|
||||
</opencv_storage>
|
||||
@endcode
|
||||
|
||||
Here is the 'realistic" setup used to obtain the second retina output shown on the top of this page.
|
||||
|
||||
@code{xml}
|
||||
<?xml version="1.0"?>
|
||||
<opencv_storage>
|
||||
<OPLandIPLparvo>
|
||||
<colorMode>1</colorMode>
|
||||
<normaliseOutput>1</normaliseOutput>
|
||||
<photoreceptorsLocalAdaptationSensitivity>8.9e-01</photoreceptorsLocalAdaptationSensitivity>
|
||||
<photoreceptorsTemporalConstant>9.0e-01</photoreceptorsTemporalConstant>
|
||||
<photoreceptorsSpatialConstant>5.3e-01</photoreceptorsSpatialConstant>
|
||||
<horizontalCellsGain>0.3</horizontalCellsGain>
|
||||
<hcellsTemporalConstant>0.5</hcellsTemporalConstant>
|
||||
<hcellsSpatialConstant>7.</hcellsSpatialConstant>
|
||||
<ganglionCellsSensitivity>8.9e-01</ganglionCellsSensitivity></OPLandIPLparvo>
|
||||
<IPLmagno>
|
||||
<normaliseOutput>1</normaliseOutput>
|
||||
<parasolCells_beta>0.</parasolCells_beta>
|
||||
<parasolCells_tau>0.</parasolCells_tau>
|
||||
<parasolCells_k>7.</parasolCells_k>
|
||||
<amacrinCellsTemporalCutFrequency>2.0e+00</amacrinCellsTemporalCutFrequency>
|
||||
<V0CompressionParameter>9.5e-01</V0CompressionParameter>
|
||||
<localAdaptintegration_tau>0.</localAdaptintegration_tau>
|
||||
<localAdaptintegration_k>7.</localAdaptintegration_k></IPLmagno>
|
||||
</opencv_storage>
|
||||
@endcode
|
||||
*/
|
||||
struct RetinaParameters{
|
||||
//! Outer Plexiform Layer (OPL) and Inner Plexiform Layer Parvocellular (IplParvo) parameters
|
||||
struct OPLandIplParvoParameters{
|
||||
OPLandIplParvoParameters():colorMode(true),
|
||||
normaliseOutput(true),
|
||||
photoreceptorsLocalAdaptationSensitivity(0.75f),
|
||||
photoreceptorsTemporalConstant(0.9f),
|
||||
photoreceptorsSpatialConstant(0.53f),
|
||||
horizontalCellsGain(0.01f),
|
||||
hcellsTemporalConstant(0.5f),
|
||||
hcellsSpatialConstant(7.f),
|
||||
ganglionCellsSensitivity(0.75f) { } // default setup
|
||||
bool colorMode, normaliseOutput;
|
||||
float photoreceptorsLocalAdaptationSensitivity, photoreceptorsTemporalConstant, photoreceptorsSpatialConstant, horizontalCellsGain, hcellsTemporalConstant, hcellsSpatialConstant, ganglionCellsSensitivity;
|
||||
};
|
||||
//! Inner Plexiform Layer Magnocellular channel (IplMagno)
|
||||
struct IplMagnoParameters{
|
||||
IplMagnoParameters():
|
||||
normaliseOutput(true),
|
||||
parasolCells_beta(0.f),
|
||||
parasolCells_tau(0.f),
|
||||
parasolCells_k(7.f),
|
||||
amacrinCellsTemporalCutFrequency(2.0f),
|
||||
V0CompressionParameter(0.95f),
|
||||
localAdaptintegration_tau(0.f),
|
||||
localAdaptintegration_k(7.f) { } // default setup
|
||||
bool normaliseOutput;
|
||||
float parasolCells_beta, parasolCells_tau, parasolCells_k, amacrinCellsTemporalCutFrequency, V0CompressionParameter, localAdaptintegration_tau, localAdaptintegration_k;
|
||||
};
|
||||
OPLandIplParvoParameters OPLandIplParvo;
|
||||
IplMagnoParameters IplMagno;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @brief class which allows the Gipsa/Listic Labs model to be used with OpenCV.
|
||||
|
||||
This retina model allows spatio-temporal image processing (applied on still images, video sequences).
|
||||
As a summary, these are the retina model properties:
|
||||
- It applies a spectral whithening (mid-frequency details enhancement)
|
||||
- high frequency spatio-temporal noise reduction
|
||||
- low frequency luminance to be reduced (luminance range compression)
|
||||
- local logarithmic luminance compression allows details to be enhanced in low light conditions
|
||||
|
||||
USE : this model can be used basically for spatio-temporal video effects but also for :
|
||||
_using the getParvo method output matrix : texture analysiswith enhanced signal to noise ratio and enhanced details robust against input images luminance ranges
|
||||
_using the getMagno method output matrix : motion analysis also with the previously cited properties
|
||||
|
||||
for more information, reer to the following papers :
|
||||
Benoit A., Caplier A., Durette B., Herault, J., "USING HUMAN VISUAL SYSTEM MODELING FOR BIO-INSPIRED LOW LEVEL IMAGE PROCESSING", Elsevier, Computer Vision and Image Understanding 114 (2010), pp. 758-773, DOI: http://dx.doi.org/10.1016/j.cviu.2010.01.011
|
||||
Vision: Images, Signals and Neural Networks: Models of Neural Processing in Visual Perception (Progress in Neural Processing),By: Jeanny Herault, ISBN: 9814273686. WAPI (Tower ID): 113266891.
|
||||
|
||||
The retina filter includes the research contributions of phd/research collegues from which code has been redrawn by the author :
|
||||
take a look at the retinacolor.hpp module to discover Brice Chaix de Lavarene color mosaicing/demosaicing and the reference paper:
|
||||
B. Chaix de Lavarene, D. Alleysson, B. Durette, J. Herault (2007). "Efficient demosaicing through recursive filtering", IEEE International Conference on Image Processing ICIP 2007
|
||||
take a look at imagelogpolprojection.hpp to discover retina spatial log sampling which originates from Barthelemy Durette phd with Jeanny Herault. A Retina / V1 cortex projection is also proposed and originates from Jeanny's discussions.
|
||||
more informations in the above cited Jeanny Heraults's book.
|
||||
*/
|
||||
class CV_EXPORTS_W Retina : public Algorithm {
|
||||
|
||||
public:
|
||||
|
||||
|
||||
/** @brief Retreive retina input buffer size
|
||||
@return the retina input buffer size
|
||||
*/
|
||||
CV_WRAP virtual Size getInputSize()=0;
|
||||
|
||||
/** @brief Retreive retina output buffer size that can be different from the input if a spatial log
|
||||
transformation is applied
|
||||
@return the retina output buffer size
|
||||
*/
|
||||
CV_WRAP virtual Size getOutputSize()=0;
|
||||
|
||||
/** @brief Try to open an XML retina parameters file to adjust current retina instance setup
|
||||
|
||||
- if the xml file does not exist, then default setup is applied
|
||||
- warning, Exceptions are thrown if read XML file is not valid
|
||||
@param retinaParameterFile the parameters filename
|
||||
@param applyDefaultSetupOnFailure set to true if an error must be thrown on error
|
||||
|
||||
You can retrieve the current parameters structure using the method Retina::getParameters and update
|
||||
it before running method Retina::setup.
|
||||
*/
|
||||
CV_WRAP virtual void setup(String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true)=0;
|
||||
|
||||
/** @overload
|
||||
@param fs the open Filestorage which contains retina parameters
|
||||
@param applyDefaultSetupOnFailure set to true if an error must be thrown on error
|
||||
*/
|
||||
virtual void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure=true)=0;
|
||||
|
||||
/** @overload
|
||||
@param newParameters a parameters structures updated with the new target configuration.
|
||||
*/
|
||||
virtual void setup(RetinaParameters newParameters)=0;
|
||||
|
||||
/**
|
||||
@return the current parameters setup
|
||||
*/
|
||||
virtual RetinaParameters getParameters()=0;
|
||||
|
||||
/** @brief Outputs a string showing the used parameters setup
|
||||
@return a string which contains formated parameters information
|
||||
*/
|
||||
CV_WRAP virtual const String printSetup()=0;
|
||||
|
||||
/** @brief Write xml/yml formated parameters information
|
||||
@param fs the filename of the xml file that will be open and writen with formatted parameters
|
||||
information
|
||||
*/
|
||||
CV_WRAP virtual void write( String fs ) const=0;
|
||||
|
||||
/** @overload */
|
||||
virtual void write( FileStorage& fs ) const CV_OVERRIDE = 0;
|
||||
|
||||
/** @brief Setup the OPL and IPL parvo channels (see biologocal model)
|
||||
|
||||
OPL is referred as Outer Plexiform Layer of the retina, it allows the spatio-temporal filtering
|
||||
which withens the spectrum and reduces spatio-temporal noise while attenuating global luminance
|
||||
(low frequency energy) IPL parvo is the OPL next processing stage, it refers to a part of the
|
||||
Inner Plexiform layer of the retina, it allows high contours sensitivity in foveal vision. See
|
||||
reference papers for more informations.
|
||||
for more informations, please have a look at the paper Benoit A., Caplier A., Durette B., Herault, J., "USING HUMAN VISUAL SYSTEM MODELING FOR BIO-INSPIRED LOW LEVEL IMAGE PROCESSING", Elsevier, Computer Vision and Image Understanding 114 (2010), pp. 758-773, DOI: http://dx.doi.org/10.1016/j.cviu.2010.01.011
|
||||
@param colorMode specifies if (true) color is processed of not (false) to then processing gray
|
||||
level image
|
||||
@param normaliseOutput specifies if (true) output is rescaled between 0 and 255 of not (false)
|
||||
@param photoreceptorsLocalAdaptationSensitivity the photoreceptors sensitivity renage is 0-1
|
||||
(more log compression effect when value increases)
|
||||
@param photoreceptorsTemporalConstant the time constant of the first order low pass filter of
|
||||
the photoreceptors, use it to cut high temporal frequencies (noise or fast motion), unit is
|
||||
frames, typical value is 1 frame
|
||||
@param photoreceptorsSpatialConstant the spatial constant of the first order low pass filter of
|
||||
the photoreceptors, use it to cut high spatial frequencies (noise or thick contours), unit is
|
||||
pixels, typical value is 1 pixel
|
||||
@param horizontalCellsGain gain of the horizontal cells network, if 0, then the mean value of
|
||||
the output is zero, if the parameter is near 1, then, the luminance is not filtered and is
|
||||
still reachable at the output, typicall value is 0
|
||||
@param HcellsTemporalConstant the time constant of the first order low pass filter of the
|
||||
horizontal cells, use it to cut low temporal frequencies (local luminance variations), unit is
|
||||
frames, typical value is 1 frame, as the photoreceptors
|
||||
@param HcellsSpatialConstant the spatial constant of the first order low pass filter of the
|
||||
horizontal cells, use it to cut low spatial frequencies (local luminance), unit is pixels,
|
||||
typical value is 5 pixel, this value is also used for local contrast computing when computing
|
||||
the local contrast adaptation at the ganglion cells level (Inner Plexiform Layer parvocellular
|
||||
channel model)
|
||||
@param ganglionCellsSensitivity the compression strengh of the ganglion cells local adaptation
|
||||
output, set a value between 0.6 and 1 for best results, a high value increases more the low
|
||||
value sensitivity... and the output saturates faster, recommended value: 0.7
|
||||
*/
|
||||
CV_WRAP virtual void setupOPLandIPLParvoChannel(const bool colorMode=true, const bool normaliseOutput = true, const float photoreceptorsLocalAdaptationSensitivity=0.7f, const float photoreceptorsTemporalConstant=0.5f, const float photoreceptorsSpatialConstant=0.53f, const float horizontalCellsGain=0.f, const float HcellsTemporalConstant=1.f, const float HcellsSpatialConstant=7.f, const float ganglionCellsSensitivity=0.7f)=0;
|
||||
|
||||
/** @brief Set parameters values for the Inner Plexiform Layer (IPL) magnocellular channel
|
||||
|
||||
this channel processes signals output from OPL processing stage in peripheral vision, it allows
|
||||
motion information enhancement. It is decorrelated from the details channel. See reference
|
||||
papers for more details.
|
||||
|
||||
@param normaliseOutput specifies if (true) output is rescaled between 0 and 255 of not (false)
|
||||
@param parasolCells_beta the low pass filter gain used for local contrast adaptation at the
|
||||
IPL level of the retina (for ganglion cells local adaptation), typical value is 0
|
||||
@param parasolCells_tau the low pass filter time constant used for local contrast adaptation
|
||||
at the IPL level of the retina (for ganglion cells local adaptation), unit is frame, typical
|
||||
value is 0 (immediate response)
|
||||
@param parasolCells_k the low pass filter spatial constant used for local contrast adaptation
|
||||
at the IPL level of the retina (for ganglion cells local adaptation), unit is pixels, typical
|
||||
value is 5
|
||||
@param amacrinCellsTemporalCutFrequency the time constant of the first order high pass fiter of
|
||||
the magnocellular way (motion information channel), unit is frames, typical value is 1.2
|
||||
@param V0CompressionParameter the compression strengh of the ganglion cells local adaptation
|
||||
output, set a value between 0.6 and 1 for best results, a high value increases more the low
|
||||
value sensitivity... and the output saturates faster, recommended value: 0.95
|
||||
@param localAdaptintegration_tau specifies the temporal constant of the low pas filter
|
||||
involved in the computation of the local "motion mean" for the local adaptation computation
|
||||
@param localAdaptintegration_k specifies the spatial constant of the low pas filter involved
|
||||
in the computation of the local "motion mean" for the local adaptation computation
|
||||
*/
|
||||
CV_WRAP virtual void setupIPLMagnoChannel(const bool normaliseOutput = true, const float parasolCells_beta=0.f, const float parasolCells_tau=0.f, const float parasolCells_k=7.f, const float amacrinCellsTemporalCutFrequency=1.2f, const float V0CompressionParameter=0.95f, const float localAdaptintegration_tau=0.f, const float localAdaptintegration_k=7.f)=0;
|
||||
|
||||
/** @brief Method which allows retina to be applied on an input image,
|
||||
|
||||
after run, encapsulated retina module is ready to deliver its outputs using dedicated
|
||||
acccessors, see getParvo and getMagno methods
|
||||
@param inputImage the input Mat image to be processed, can be gray level or BGR coded in any
|
||||
format (from 8bit to 16bits)
|
||||
*/
|
||||
CV_WRAP virtual void run(InputArray inputImage)=0;
|
||||
|
||||
/** @brief Method which processes an image in the aim to correct its luminance correct
|
||||
backlight problems, enhance details in shadows.
|
||||
|
||||
This method is designed to perform High Dynamic Range image tone mapping (compress \>8bit/pixel
|
||||
images to 8bit/pixel). This is a simplified version of the Retina Parvocellular model
|
||||
(simplified version of the run/getParvo methods call) since it does not include the
|
||||
spatio-temporal filter modelling the Outer Plexiform Layer of the retina that performs spectral
|
||||
whitening and many other stuff. However, it works great for tone mapping and in a faster way.
|
||||
|
||||
Check the demos and experiments section to see examples and the way to perform tone mapping
|
||||
using the original retina model and the method.
|
||||
|
||||
@param inputImage the input image to process (should be coded in float format : CV_32F,
|
||||
CV_32FC1, CV_32F_C3, CV_32F_C4, the 4th channel won't be considered).
|
||||
@param outputToneMappedImage the output 8bit/channel tone mapped image (CV_8U or CV_8UC3 format).
|
||||
*/
|
||||
CV_WRAP virtual void applyFastToneMapping(InputArray inputImage, OutputArray outputToneMappedImage)=0;
|
||||
|
||||
/** @brief Accessor of the details channel of the retina (models foveal vision).
|
||||
|
||||
Warning, getParvoRAW methods return buffers that are not rescaled within range [0;255] while
|
||||
the non RAW method allows a normalized matrix to be retrieved.
|
||||
|
||||
@param retinaOutput_parvo the output buffer (reallocated if necessary), format can be :
|
||||
- a Mat, this output is rescaled for standard 8bits image processing use in OpenCV
|
||||
- RAW methods actually return a 1D matrix (encoding is R1, R2, ... Rn, G1, G2, ..., Gn, B1,
|
||||
B2, ...Bn), this output is the original retina filter model output, without any
|
||||
quantification or rescaling.
|
||||
@see getParvoRAW
|
||||
*/
|
||||
CV_WRAP virtual void getParvo(OutputArray retinaOutput_parvo)=0;
|
||||
|
||||
/** @brief Accessor of the details channel of the retina (models foveal vision).
|
||||
@see getParvo
|
||||
*/
|
||||
CV_WRAP virtual void getParvoRAW(OutputArray retinaOutput_parvo)=0;
|
||||
|
||||
/** @brief Accessor of the motion channel of the retina (models peripheral vision).
|
||||
|
||||
Warning, getMagnoRAW methods return buffers that are not rescaled within range [0;255] while
|
||||
the non RAW method allows a normalized matrix to be retrieved.
|
||||
@param retinaOutput_magno the output buffer (reallocated if necessary), format can be :
|
||||
- a Mat, this output is rescaled for standard 8bits image processing use in OpenCV
|
||||
- RAW methods actually return a 1D matrix (encoding is M1, M2,... Mn), this output is the
|
||||
original retina filter model output, without any quantification or rescaling.
|
||||
@see getMagnoRAW
|
||||
*/
|
||||
CV_WRAP virtual void getMagno(OutputArray retinaOutput_magno)=0;
|
||||
|
||||
/** @brief Accessor of the motion channel of the retina (models peripheral vision).
|
||||
@see getMagno
|
||||
*/
|
||||
CV_WRAP virtual void getMagnoRAW(OutputArray retinaOutput_magno)=0;
|
||||
|
||||
/** @overload */
|
||||
CV_WRAP virtual const Mat getMagnoRAW() const=0;
|
||||
/** @overload */
|
||||
CV_WRAP virtual const Mat getParvoRAW() const=0;
|
||||
|
||||
/** @brief Activate color saturation as the final step of the color demultiplexing process -\> this
|
||||
saturation is a sigmoide function applied to each channel of the demultiplexed image.
|
||||
@param saturateColors boolean that activates color saturation (if true) or desactivate (if false)
|
||||
@param colorSaturationValue the saturation factor : a simple factor applied on the chrominance
|
||||
buffers
|
||||
*/
|
||||
CV_WRAP virtual void setColorSaturation(const bool saturateColors=true, const float colorSaturationValue=4.0f)=0;
|
||||
|
||||
/** @brief Clears all retina buffers
|
||||
|
||||
(equivalent to opening the eyes after a long period of eye close ;o) whatchout the temporal
|
||||
transition occuring just after this method call.
|
||||
*/
|
||||
CV_WRAP virtual void clearBuffers()=0;
|
||||
|
||||
/** @brief Activate/desactivate the Magnocellular pathway processing (motion information extraction), by
|
||||
default, it is activated
|
||||
@param activate true if Magnocellular output should be activated, false if not... if activated,
|
||||
the Magnocellular output can be retrieved using the **getMagno** methods
|
||||
*/
|
||||
CV_WRAP virtual void activateMovingContoursProcessing(const bool activate)=0;
|
||||
|
||||
/** @brief Activate/desactivate the Parvocellular pathway processing (contours information extraction), by
|
||||
default, it is activated
|
||||
@param activate true if Parvocellular (contours information extraction) output should be
|
||||
activated, false if not... if activated, the Parvocellular output can be retrieved using the
|
||||
Retina::getParvo methods
|
||||
*/
|
||||
CV_WRAP virtual void activateContoursProcessing(const bool activate)=0;
|
||||
|
||||
/** @overload */
|
||||
CV_WRAP static Ptr<Retina> create(Size inputSize);
|
||||
/** @brief Constructors from standardized interfaces : retreive a smart pointer to a Retina instance
|
||||
|
||||
@param inputSize the input frame size
|
||||
@param colorMode the chosen processing mode : with or without color processing
|
||||
@param colorSamplingMethod specifies which kind of color sampling will be used :
|
||||
- cv::bioinspired::RETINA_COLOR_RANDOM: each pixel position is either R, G or B in a random choice
|
||||
- cv::bioinspired::RETINA_COLOR_DIAGONAL: color sampling is RGBRGBRGB..., line 2 BRGBRGBRG..., line 3, GBRGBRGBR...
|
||||
- cv::bioinspired::RETINA_COLOR_BAYER: standard bayer sampling
|
||||
@param useRetinaLogSampling activate retina log sampling, if true, the 2 following parameters can
|
||||
be used
|
||||
@param reductionFactor only usefull if param useRetinaLogSampling=true, specifies the reduction
|
||||
factor of the output frame (as the center (fovea) is high resolution and corners can be
|
||||
underscaled, then a reduction of the output is allowed without precision leak
|
||||
@param samplingStrength only usefull if param useRetinaLogSampling=true, specifies the strength of
|
||||
the log scale that is applied
|
||||
*/
|
||||
CV_WRAP static Ptr<Retina> create(Size inputSize, const bool colorMode,
|
||||
int colorSamplingMethod=RETINA_COLOR_BAYER,
|
||||
const bool useRetinaLogSampling=false,
|
||||
const float reductionFactor=1.0f, const float samplingStrength=10.0f);
|
||||
};
|
||||
|
||||
//! @}
|
||||
|
||||
}
|
||||
}
|
||||
#endif /* __OPENCV_BIOINSPIRED_RETINA_HPP__ */
|
||||
138
3rdparty/include/opencv2/bioinspired/retinafasttonemapping.hpp
vendored
Normal file
138
3rdparty/include/opencv2/bioinspired/retinafasttonemapping.hpp
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
|
||||
/*#******************************************************************************
|
||||
** IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
**
|
||||
** By downloading, copying, installing or using the software you agree to this license.
|
||||
** If you do not agree to this license, do not download, install,
|
||||
** copy or use the software.
|
||||
**
|
||||
**
|
||||
** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab.
|
||||
**
|
||||
** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications)
|
||||
**
|
||||
** Creation - enhancement process 2007-2013
|
||||
** Author: Alexandre Benoit (benoit.alexandre.vision@gmail.com), LISTIC lab, Annecy le vieux, France
|
||||
**
|
||||
** Theses algorithm have been developped by Alexandre BENOIT since his thesis with Alice Caplier at Gipsa-Lab (www.gipsa-lab.inpg.fr) and the research he pursues at LISTIC Lab (www.listic.univ-savoie.fr).
|
||||
** Refer to the following research paper for more information:
|
||||
** Benoit A., Caplier A., Durette B., Herault, J., "USING HUMAN VISUAL SYSTEM MODELING FOR BIO-INSPIRED LOW LEVEL IMAGE PROCESSING", Elsevier, Computer Vision and Image Understanding 114 (2010), pp. 758-773, DOI: http://dx.doi.org/10.1016/j.cviu.2010.01.011
|
||||
** This work have been carried out thanks to Jeanny Herault who's research and great discussions are the basis of all this work, please take a look at his book:
|
||||
** Vision: Images, Signals and Neural Networks: Models of Neural Processing in Visual Perception (Progress in Neural Processing),By: Jeanny Herault, ISBN: 9814273686. WAPI (Tower ID): 113266891.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** This class is based on image processing tools of the author and already used within the Retina class (this is the same code as method retina::applyFastToneMapping, but in an independent class, it is ligth from a memory requirement point of view). It implements an adaptation of the efficient tone mapping algorithm propose by David Alleyson, Sabine Susstruck and Laurence Meylan's work, please cite:
|
||||
** -> Meylan L., Alleysson D., and Susstrunk S., A Model of Retinal Local Adaptation for the Tone Mapping of Color Filter Array Images, Journal of Optical Society of America, A, Vol. 24, N 9, September, 1st, 2007, pp. 2807-2816
|
||||
**
|
||||
**
|
||||
** License Agreement
|
||||
** For Open Source Computer Vision Library
|
||||
**
|
||||
** Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved.
|
||||
**
|
||||
** For Human Visual System tools (bioinspired)
|
||||
** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved.
|
||||
**
|
||||
** Third party copyrights are property of their respective owners.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** * The name of the copyright holders may not 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 Intel Corporation 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.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __OPENCV_BIOINSPIRED_RETINAFASTTONEMAPPING_HPP__
|
||||
#define __OPENCV_BIOINSPIRED_RETINAFASTTONEMAPPING_HPP__
|
||||
|
||||
/**
|
||||
@file
|
||||
@date May 26, 2013
|
||||
@author Alexandre Benoit
|
||||
*/
|
||||
|
||||
#include "opencv2/core.hpp" // for all OpenCV core functionalities access, including cv::Exception support
|
||||
|
||||
namespace cv{
|
||||
namespace bioinspired{
|
||||
|
||||
//! @addtogroup bioinspired
|
||||
//! @{
|
||||
|
||||
/** @brief a wrapper class which allows the tone mapping algorithm of Meylan&al(2007) to be used with OpenCV.
|
||||
|
||||
This algorithm is already implemented in thre Retina class (retina::applyFastToneMapping) but used it does not require all the retina model to be allocated. This allows a light memory use for low memory devices (smartphones, etc.
|
||||
As a summary, these are the model properties:
|
||||
- 2 stages of local luminance adaptation with a different local neighborhood for each.
|
||||
- first stage models the retina photorecetors local luminance adaptation
|
||||
- second stage models th ganglion cells local information adaptation
|
||||
- compared to the initial publication, this class uses spatio-temporal low pass filters instead of spatial only filters.
|
||||
this can help noise robustness and temporal stability for video sequence use cases.
|
||||
|
||||
for more information, read to the following papers :
|
||||
Meylan L., Alleysson D., and Susstrunk S., A Model of Retinal Local Adaptation for the Tone Mapping of Color Filter Array Images, Journal of Optical Society of America, A, Vol. 24, N 9, September, 1st, 2007, pp. 2807-2816Benoit A., Caplier A., Durette B., Herault, J., "USING HUMAN VISUAL SYSTEM MODELING FOR BIO-INSPIRED LOW LEVEL IMAGE PROCESSING", Elsevier, Computer Vision and Image Understanding 114 (2010), pp. 758-773, DOI: http://dx.doi.org/10.1016/j.cviu.2010.01.011
|
||||
regarding spatio-temporal filter and the bigger retina model :
|
||||
Vision: Images, Signals and Neural Networks: Models of Neural Processing in Visual Perception (Progress in Neural Processing),By: Jeanny Herault, ISBN: 9814273686. WAPI (Tower ID): 113266891.
|
||||
*/
|
||||
class CV_EXPORTS_W RetinaFastToneMapping : public Algorithm
|
||||
{
|
||||
public:
|
||||
|
||||
/** @brief applies a luminance correction (initially High Dynamic Range (HDR) tone mapping)
|
||||
|
||||
using only the 2 local adaptation stages of the retina parvocellular channel : photoreceptors
|
||||
level and ganlion cells level. Spatio temporal filtering is applied but limited to temporal
|
||||
smoothing and eventually high frequencies attenuation. This is a lighter method than the one
|
||||
available using the regular retina::run method. It is then faster but it does not include
|
||||
complete temporal filtering nor retina spectral whitening. Then, it can have a more limited
|
||||
effect on images with a very high dynamic range. This is an adptation of the original still
|
||||
image HDR tone mapping algorithm of David Alleyson, Sabine Susstruck and Laurence Meylan's
|
||||
work, please cite: -> Meylan L., Alleysson D., and Susstrunk S., A Model of Retinal Local
|
||||
Adaptation for the Tone Mapping of Color Filter Array Images, Journal of Optical Society of
|
||||
America, A, Vol. 24, N 9, September, 1st, 2007, pp. 2807-2816
|
||||
|
||||
@param inputImage the input image to process RGB or gray levels
|
||||
@param outputToneMappedImage the output tone mapped image
|
||||
*/
|
||||
CV_WRAP virtual void applyFastToneMapping(InputArray inputImage, OutputArray outputToneMappedImage)=0;
|
||||
|
||||
/** @brief updates tone mapping behaviors by adjusing the local luminance computation area
|
||||
|
||||
@param photoreceptorsNeighborhoodRadius the first stage local adaptation area
|
||||
@param ganglioncellsNeighborhoodRadius the second stage local adaptation area
|
||||
@param meanLuminanceModulatorK the factor applied to modulate the meanLuminance information
|
||||
(default is 1, see reference paper)
|
||||
*/
|
||||
CV_WRAP virtual void setup(const float photoreceptorsNeighborhoodRadius=3.f, const float ganglioncellsNeighborhoodRadius=1.f, const float meanLuminanceModulatorK=1.f)=0;
|
||||
|
||||
CV_WRAP static Ptr<RetinaFastToneMapping> create(Size inputSize);
|
||||
};
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
}
|
||||
}
|
||||
#endif /* __OPENCV_BIOINSPIRED_RETINAFASTTONEMAPPING_HPP__ */
|
||||
204
3rdparty/include/opencv2/bioinspired/transientareassegmentationmodule.hpp
vendored
Normal file
204
3rdparty/include/opencv2/bioinspired/transientareassegmentationmodule.hpp
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
/*#******************************************************************************
|
||||
** IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
**
|
||||
** By downloading, copying, installing or using the software you agree to this license.
|
||||
** If you do not agree to this license, do not download, install,
|
||||
** copy or use the software.
|
||||
**
|
||||
**
|
||||
** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models.
|
||||
** TransientAreasSegmentationModule Use: extract areas that present spatio-temporal changes.
|
||||
** => It should be used at the output of the cv::bioinspired::Retina::getMagnoRAW() output that enhances spatio-temporal changes
|
||||
**
|
||||
** Maintainers : Listic lab (code author current affiliation & applications)
|
||||
**
|
||||
** Creation - enhancement process 2007-2015
|
||||
** Author: Alexandre Benoit (benoit.alexandre.vision@gmail.com), LISTIC lab, Annecy le vieux, France
|
||||
**
|
||||
** Theses algorithm have been developped by Alexandre BENOIT since his thesis with Alice Caplier at Gipsa-Lab (www.gipsa-lab.inpg.fr) and the research he pursues at LISTIC Lab (www.listic.univ-savoie.fr).
|
||||
** Refer to the following research paper for more information:
|
||||
** Strat, S.T.; Benoit, A.; Lambert, P., "Retina enhanced bag of words descriptors for video classification," Signal Processing Conference (EUSIPCO), 2014 Proceedings of the 22nd European , vol., no., pp.1307,1311, 1-5 Sept. 2014 (http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=6952461&isnumber=6951911)
|
||||
** Benoit A., Caplier A., Durette B., Herault, J., "USING HUMAN VISUAL SYSTEM MODELING FOR BIO-INSPIRED LOW LEVEL IMAGE PROCESSING", Elsevier, Computer Vision and Image Understanding 114 (2010), pp. 758-773, DOI: http://dx.doi.org/10.1016/j.cviu.2010.01.011
|
||||
** This work have been carried out thanks to Jeanny Herault who's research and great discussions are the basis of all this work, please take a look at his book:
|
||||
** Vision: Images, Signals and Neural Networks: Models of Neural Processing in Visual Perception (Progress in Neural Processing),By: Jeanny Herault, ISBN: 9814273686. WAPI (Tower ID): 113266891.
|
||||
**
|
||||
**
|
||||
** License Agreement
|
||||
** For Open Source Computer Vision Library
|
||||
**
|
||||
** Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved.
|
||||
**
|
||||
** For Human Visual System tools (bioinspired)
|
||||
** Copyright (C) 2007-2015, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved.
|
||||
**
|
||||
** Third party copyrights are property of their respective owners.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** * The name of the copyright holders may not 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 Intel Corporation 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.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef SEGMENTATIONMODULE_HPP_
|
||||
#define SEGMENTATIONMODULE_HPP_
|
||||
|
||||
/**
|
||||
@file
|
||||
@date 2007-2013
|
||||
@author Alexandre BENOIT, benoit.alexandre.vision@gmail.com
|
||||
*/
|
||||
|
||||
#include "opencv2/core.hpp" // for all OpenCV core functionalities access, including cv::Exception support
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace bioinspired
|
||||
{
|
||||
//! @addtogroup bioinspired
|
||||
//! @{
|
||||
|
||||
/** @brief parameter structure that stores the transient events detector setup parameters
|
||||
*/
|
||||
struct SegmentationParameters{ // CV_EXPORTS_W_MAP to export to python native dictionnaries
|
||||
// default structure instance construction with default values
|
||||
SegmentationParameters():
|
||||
thresholdON(100),
|
||||
thresholdOFF(100),
|
||||
localEnergy_temporalConstant(0.5),
|
||||
localEnergy_spatialConstant(5),
|
||||
neighborhoodEnergy_temporalConstant(1),
|
||||
neighborhoodEnergy_spatialConstant(15),
|
||||
contextEnergy_temporalConstant(1),
|
||||
contextEnergy_spatialConstant(75){};
|
||||
// all properties list
|
||||
float thresholdON;
|
||||
float thresholdOFF;
|
||||
//! the time constant of the first order low pass filter, use it to cut high temporal frequencies (noise or fast motion), unit is frames, typical value is 0.5 frame
|
||||
float localEnergy_temporalConstant;
|
||||
//! the spatial constant of the first order low pass filter, use it to cut high spatial frequencies (noise or thick contours), unit is pixels, typical value is 5 pixel
|
||||
float localEnergy_spatialConstant;
|
||||
//! local neighborhood energy filtering parameters : the aim is to get information about the energy neighborhood to perform a center surround energy analysis
|
||||
float neighborhoodEnergy_temporalConstant;
|
||||
float neighborhoodEnergy_spatialConstant;
|
||||
//! context neighborhood energy filtering parameters : the aim is to get information about the energy on a wide neighborhood area to filtered out local effects
|
||||
float contextEnergy_temporalConstant;
|
||||
float contextEnergy_spatialConstant;
|
||||
};
|
||||
|
||||
/** @brief class which provides a transient/moving areas segmentation module
|
||||
|
||||
perform a locally adapted segmentation by using the retina magno input data Based on Alexandre
|
||||
BENOIT thesis: "Le système visuel humain au secours de la vision par ordinateur"
|
||||
|
||||
3 spatio temporal filters are used:
|
||||
- a first one which filters the noise and local variations of the input motion energy
|
||||
- a second (more powerfull low pass spatial filter) which gives the neighborhood motion energy the
|
||||
segmentation consists in the comparison of these both outputs, if the local motion energy is higher
|
||||
to the neighborhood otion energy, then the area is considered as moving and is segmented
|
||||
- a stronger third low pass filter helps decision by providing a smooth information about the
|
||||
"motion context" in a wider area
|
||||
*/
|
||||
|
||||
class CV_EXPORTS_W TransientAreasSegmentationModule: public Algorithm
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
/** @brief return the sze of the manage input and output images
|
||||
*/
|
||||
CV_WRAP virtual Size getSize()=0;
|
||||
|
||||
/** @brief try to open an XML segmentation parameters file to adjust current segmentation instance setup
|
||||
|
||||
- if the xml file does not exist, then default setup is applied
|
||||
- warning, Exceptions are thrown if read XML file is not valid
|
||||
@param segmentationParameterFile : the parameters filename
|
||||
@param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
|
||||
*/
|
||||
CV_WRAP virtual void setup(String segmentationParameterFile="", const bool applyDefaultSetupOnFailure=true)=0;
|
||||
|
||||
/** @brief try to open an XML segmentation parameters file to adjust current segmentation instance setup
|
||||
|
||||
- if the xml file does not exist, then default setup is applied
|
||||
- warning, Exceptions are thrown if read XML file is not valid
|
||||
@param fs : the open Filestorage which contains segmentation parameters
|
||||
@param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
|
||||
*/
|
||||
virtual void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure=true)=0;
|
||||
|
||||
/** @brief try to open an XML segmentation parameters file to adjust current segmentation instance setup
|
||||
|
||||
- if the xml file does not exist, then default setup is applied
|
||||
- warning, Exceptions are thrown if read XML file is not valid
|
||||
@param newParameters : a parameters structures updated with the new target configuration
|
||||
*/
|
||||
virtual void setup(SegmentationParameters newParameters)=0;
|
||||
|
||||
/** @brief return the current parameters setup
|
||||
*/
|
||||
virtual SegmentationParameters getParameters()=0;
|
||||
|
||||
/** @brief parameters setup display method
|
||||
@return a string which contains formatted parameters information
|
||||
*/
|
||||
CV_WRAP virtual const String printSetup()=0;
|
||||
|
||||
/** @brief write xml/yml formated parameters information
|
||||
@param fs : the filename of the xml file that will be open and writen with formatted parameters information
|
||||
*/
|
||||
CV_WRAP virtual void write( String fs ) const=0;
|
||||
|
||||
/** @brief write xml/yml formated parameters information
|
||||
@param fs : a cv::Filestorage object ready to be filled
|
||||
*/
|
||||
virtual void write( cv::FileStorage& fs ) const CV_OVERRIDE = 0;
|
||||
|
||||
/** @brief main processing method, get result using methods getSegmentationPicture()
|
||||
@param inputToSegment : the image to process, it must match the instance buffer size !
|
||||
@param channelIndex : the channel to process in case of multichannel images
|
||||
*/
|
||||
CV_WRAP virtual void run(InputArray inputToSegment, const int channelIndex=0)=0;
|
||||
|
||||
/** @brief access function
|
||||
return the last segmentation result: a boolean picture which is resampled between 0 and 255 for a display purpose
|
||||
*/
|
||||
CV_WRAP virtual void getSegmentationPicture(OutputArray transientAreas)=0;
|
||||
|
||||
/** @brief cleans all the buffers of the instance
|
||||
*/
|
||||
CV_WRAP virtual void clearAllBuffers()=0;
|
||||
|
||||
/** @brief allocator
|
||||
@param inputSize : size of the images input to segment (output will be the same size)
|
||||
*/
|
||||
CV_WRAP static Ptr<TransientAreasSegmentationModule> create(Size inputSize);
|
||||
};
|
||||
|
||||
//! @}
|
||||
|
||||
}} // namespaces end : cv and bioinspired
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1510,8 +1510,8 @@ concatenated together.
|
||||
@param imageSize Size of the image used only to initialize the camera intrinsic matrix.
|
||||
@param cameraMatrix Input/output 3x3 floating-point camera intrinsic matrix
|
||||
\f$\cameramatrix{A}\f$ . If @ref CALIB_USE_INTRINSIC_GUESS
|
||||
and/or @ref CALIB_FIX_ASPECT_RATIO, @ref CALIB_FIX_PRINCIPAL_POINT or @ref CALIB_FIX_FOCAL_LENGTH
|
||||
are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.
|
||||
and/or @ref CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be
|
||||
initialized before calling the function.
|
||||
@param distCoeffs Input/output vector of distortion coefficients
|
||||
\f$\distcoeffs\f$.
|
||||
@param rvecs Output vector of rotation vectors (@ref Rodrigues ) estimated for each pattern view
|
||||
@@ -1537,7 +1537,7 @@ the number of pattern views. \f$R_i, T_i\f$ are concatenated 1x3 vectors.
|
||||
fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
|
||||
center ( imageSize is used), and focal distances are computed in a least-squares fashion.
|
||||
Note, that if intrinsic parameters are known, there is no need to use this function just to
|
||||
estimate extrinsic parameters. Use @ref solvePnP instead.
|
||||
estimate extrinsic parameters. Use solvePnP instead.
|
||||
- @ref CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
|
||||
optimization. It stays at the center or at a different location specified when
|
||||
@ref CALIB_USE_INTRINSIC_GUESS is set too.
|
||||
@@ -1547,23 +1547,24 @@ ratio fx/fy stays the same as in the input cameraMatrix . When
|
||||
ignored, only their ratio is computed and used further.
|
||||
- @ref CALIB_ZERO_TANGENT_DIST Tangential distortion coefficients \f$(p_1, p_2)\f$ are set
|
||||
to zeros and stay zero.
|
||||
- @ref CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global optimization if
|
||||
@ref CALIB_USE_INTRINSIC_GUESS is set.
|
||||
- @ref CALIB_FIX_K1,..., @ref CALIB_FIX_K6 The corresponding radial distortion
|
||||
coefficient is not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is
|
||||
set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
|
||||
- @ref CALIB_RATIONAL_MODEL Coefficients k4, k5, and k6 are enabled. To provide the
|
||||
backward compatibility, this extra flag should be explicitly specified to make the
|
||||
calibration function use the rational model and return 8 coefficients or more.
|
||||
calibration function use the rational model and return 8 coefficients. If the flag is not
|
||||
set, the function computes and returns only 5 distortion coefficients.
|
||||
- @ref CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
|
||||
backward compatibility, this extra flag should be explicitly specified to make the
|
||||
calibration function use the thin prism model and return 12 coefficients or more.
|
||||
calibration function use the thin prism model and return 12 coefficients. If the flag is not
|
||||
set, the function computes and returns only 5 distortion coefficients.
|
||||
- @ref CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
|
||||
the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
|
||||
supplied distCoeffs matrix is used. Otherwise, it is set to 0.
|
||||
- @ref CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
|
||||
backward compatibility, this extra flag should be explicitly specified to make the
|
||||
calibration function use the tilted sensor model and return 14 coefficients.
|
||||
calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
|
||||
set, the function computes and returns only 5 distortion coefficients.
|
||||
- @ref CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
|
||||
the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
|
||||
supplied distCoeffs matrix is used. Otherwise, it is set to 0.
|
||||
@@ -1588,12 +1589,12 @@ The algorithm performs the following steps:
|
||||
zeros initially unless some of CALIB_FIX_K? are specified.
|
||||
|
||||
- Estimate the initial camera pose as if the intrinsic parameters have been already known. This is
|
||||
done using @ref solvePnP .
|
||||
done using solvePnP .
|
||||
|
||||
- Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error,
|
||||
that is, the total sum of squared distances between the observed feature points imagePoints and
|
||||
the projected (using the current estimates for camera parameters and the poses) object points
|
||||
objectPoints. See @ref projectPoints for details.
|
||||
objectPoints. See projectPoints for details.
|
||||
|
||||
@note
|
||||
If you use a non-square (i.e. non-N-by-N) grid and @ref findChessboardCorners for calibration,
|
||||
@@ -2240,7 +2241,6 @@ final fundamental matrix. It can be set to something like 1-3, depending on the
|
||||
point localization, image resolution, and the image noise.
|
||||
@param mask Output array of N elements, every element of which is set to 0 for outliers and to 1
|
||||
for the other points. The array is computed only in the RANSAC and LMedS methods.
|
||||
@param maxIters The maximum number of robust method iterations.
|
||||
|
||||
This function estimates essential matrix based on the five-point algorithm solver in @cite Nister03 .
|
||||
@cite SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
|
||||
@@ -2251,12 +2251,6 @@ where \f$E\f$ is an essential matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding
|
||||
second images, respectively. The result of this function may be passed further to
|
||||
decomposeEssentialMat or recoverPose to recover the relative pose between cameras.
|
||||
*/
|
||||
CV_EXPORTS_W Mat findEssentialMat( InputArray points1, InputArray points2,
|
||||
InputArray cameraMatrix, int method,
|
||||
double prob, double threshold,
|
||||
int maxIters, OutputArray mask = noArray() );
|
||||
|
||||
/** @overload */
|
||||
CV_EXPORTS_W Mat findEssentialMat( InputArray points1, InputArray points2,
|
||||
InputArray cameraMatrix, int method = RANSAC,
|
||||
double prob = 0.999, double threshold = 1.0,
|
||||
@@ -2280,7 +2274,6 @@ point localization, image resolution, and the image noise.
|
||||
confidence (probability) that the estimated matrix is correct.
|
||||
@param mask Output array of N elements, every element of which is set to 0 for outliers and to 1
|
||||
for the other points. The array is computed only in the RANSAC and LMedS methods.
|
||||
@param maxIters The maximum number of robust method iterations.
|
||||
|
||||
This function differs from the one above that it computes camera intrinsic matrix from focal length and
|
||||
principal point:
|
||||
@@ -2292,13 +2285,6 @@ f & 0 & x_{pp} \\
|
||||
0 & 0 & 1
|
||||
\end{bmatrix}\f]
|
||||
*/
|
||||
CV_EXPORTS_W Mat findEssentialMat( InputArray points1, InputArray points2,
|
||||
double focal, Point2d pp,
|
||||
int method, double prob,
|
||||
double threshold, int maxIters,
|
||||
OutputArray mask = noArray() );
|
||||
|
||||
/** @overload */
|
||||
CV_EXPORTS_W Mat findEssentialMat( InputArray points1, InputArray points2,
|
||||
double focal = 1.0, Point2d pp = Point2d(0, 0),
|
||||
int method = RANSAC, double prob = 0.999,
|
||||
157
3rdparty/include/opencv2/ccalib.hpp
vendored
Normal file
157
3rdparty/include/opencv2/ccalib.hpp
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2014, OpenCV Foundation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's 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.
|
||||
//
|
||||
// * The name of the copyright holders may not 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 Intel Corporation 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.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_CCALIB_HPP__
|
||||
#define __OPENCV_CCALIB_HPP__
|
||||
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/features2d.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/calib3d.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
/** @defgroup ccalib Custom Calibration Pattern for 3D reconstruction
|
||||
*/
|
||||
|
||||
namespace cv{ namespace ccalib{
|
||||
|
||||
//! @addtogroup ccalib
|
||||
//! @{
|
||||
|
||||
class CV_EXPORTS CustomPattern : public Algorithm
|
||||
{
|
||||
public:
|
||||
CustomPattern();
|
||||
virtual ~CustomPattern();
|
||||
|
||||
bool create(InputArray pattern, const Size2f boardSize, OutputArray output = noArray());
|
||||
|
||||
bool findPattern(InputArray image, OutputArray matched_features, OutputArray pattern_points, const double ratio = 0.7,
|
||||
const double proj_error = 8.0, const bool refine_position = false, OutputArray out = noArray(),
|
||||
OutputArray H = noArray(), OutputArray pattern_corners = noArray());
|
||||
|
||||
bool isInitialized();
|
||||
|
||||
void getPatternPoints(std::vector<KeyPoint>& original_points);
|
||||
/**<
|
||||
Returns a vector<Point> of the original points.
|
||||
*/
|
||||
double getPixelSize();
|
||||
/**<
|
||||
Get the pixel size of the pattern
|
||||
*/
|
||||
|
||||
bool setFeatureDetector(Ptr<FeatureDetector> featureDetector);
|
||||
bool setDescriptorExtractor(Ptr<DescriptorExtractor> extractor);
|
||||
bool setDescriptorMatcher(Ptr<DescriptorMatcher> matcher);
|
||||
|
||||
Ptr<FeatureDetector> getFeatureDetector();
|
||||
Ptr<DescriptorExtractor> getDescriptorExtractor();
|
||||
Ptr<DescriptorMatcher> getDescriptorMatcher();
|
||||
|
||||
double calibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints,
|
||||
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
|
||||
OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags = 0,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
|
||||
/**<
|
||||
Calls the calirateCamera function with the same inputs.
|
||||
*/
|
||||
|
||||
bool findRt(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs,
|
||||
OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE);
|
||||
bool findRt(InputArray image, InputArray cameraMatrix, InputArray distCoeffs,
|
||||
OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE);
|
||||
/**<
|
||||
Uses solvePnP to find the rotation and translation of the pattern
|
||||
with respect to the camera frame.
|
||||
*/
|
||||
|
||||
bool findRtRANSAC(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs,
|
||||
OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess = false, int iterationsCount = 100,
|
||||
float reprojectionError = 8.0, int minInliersCount = 100, OutputArray inliers = noArray(), int flags = SOLVEPNP_ITERATIVE);
|
||||
bool findRtRANSAC(InputArray image, InputArray cameraMatrix, InputArray distCoeffs,
|
||||
OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess = false, int iterationsCount = 100,
|
||||
float reprojectionError = 8.0, int minInliersCount = 100, OutputArray inliers = noArray(), int flags = SOLVEPNP_ITERATIVE);
|
||||
/**<
|
||||
Uses solvePnPRansac()
|
||||
*/
|
||||
|
||||
void drawOrientation(InputOutputArray image, InputArray tvec, InputArray rvec, InputArray cameraMatrix,
|
||||
InputArray distCoeffs, double axis_length = 3, int axis_width = 2);
|
||||
/**<
|
||||
pattern_corners -> projected over the image position of the edges of the pattern.
|
||||
*/
|
||||
|
||||
private:
|
||||
|
||||
Mat img_roi;
|
||||
std::vector<Point2f> obj_corners;
|
||||
double pxSize;
|
||||
|
||||
bool initialized;
|
||||
|
||||
Ptr<FeatureDetector> detector;
|
||||
Ptr<DescriptorExtractor> descriptorExtractor;
|
||||
Ptr<DescriptorMatcher> descriptorMatcher;
|
||||
|
||||
std::vector<KeyPoint> keypoints;
|
||||
std::vector<Point3f> points3d;
|
||||
Mat descriptor;
|
||||
|
||||
bool init(Mat& image, const float pixel_size, OutputArray output = noArray());
|
||||
bool findPatternPass(const Mat& image, std::vector<Point2f>& matched_features, std::vector<Point3f>& pattern_points,
|
||||
Mat& H, std::vector<Point2f>& scene_corners, const double pratio, const double proj_error,
|
||||
const bool refine_position = false, const Mat& mask = Mat(), OutputArray output = noArray());
|
||||
void scaleFoundPoints(const double squareSize, const std::vector<KeyPoint>& corners, std::vector<Point3f>& pts3d);
|
||||
void check_matches(std::vector<Point2f>& matched, const std::vector<Point2f>& pattern, std::vector<DMatch>& good, std::vector<Point3f>& pattern_3d, const Mat& H);
|
||||
|
||||
void keypoints2points(const std::vector<KeyPoint>& in, std::vector<Point2f>& out);
|
||||
void updateKeypointsPos(std::vector<KeyPoint>& in, const std::vector<Point2f>& new_pos);
|
||||
void refinePointsPos(const Mat& img, std::vector<Point2f>& p);
|
||||
void refineKeypointsPos(const Mat& img, std::vector<KeyPoint>& kp);
|
||||
};
|
||||
|
||||
//! @}
|
||||
|
||||
}} // namespace ccalib, cv
|
||||
|
||||
#endif
|
||||
212
3rdparty/include/opencv2/ccalib/multicalib.hpp
vendored
Normal file
212
3rdparty/include/opencv2/ccalib/multicalib.hpp
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2015, Baisheng Lai (laibaisheng@gmail.com), Zhejiang University,
|
||||
// all rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's 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.
|
||||
//
|
||||
// * The name of the copyright holders may not 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 Intel Corporation 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.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_MULTICAMERACALIBRATION_HPP__
|
||||
#define __OPENCV_MULTICAMERACALIBRATION_HPP__
|
||||
|
||||
#include "opencv2/ccalib/randpattern.hpp"
|
||||
#include "opencv2/ccalib/omnidir.hpp"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace cv { namespace multicalib {
|
||||
|
||||
//! @addtogroup ccalib
|
||||
//! @{
|
||||
|
||||
#define HEAD -1
|
||||
#define INVALID -2
|
||||
|
||||
/** @brief Class for multiple camera calibration that supports pinhole camera and omnidirection camera.
|
||||
For omnidirectional camera model, please refer to omnidir.hpp in ccalib module.
|
||||
It first calibrate each camera individually, then a bundle adjustment like optimization is applied to
|
||||
refine extrinsic parameters. So far, it only support "random" pattern for calibration,
|
||||
see randomPattern.hpp in ccalib module for details.
|
||||
Images that are used should be named by "cameraIdx-timestamp.*", several images with the same timestamp
|
||||
means that they are the same pattern that are photographed. cameraIdx should start from 0.
|
||||
|
||||
For more details, please refer to paper
|
||||
B. Li, L. Heng, K. Kevin and M. Pollefeys, "A Multiple-Camera System
|
||||
Calibration Toolbox Using A Feature Descriptor-Based Calibration
|
||||
Pattern", in IROS 2013.
|
||||
*/
|
||||
|
||||
class CV_EXPORTS MultiCameraCalibration
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
PINHOLE,
|
||||
OMNIDIRECTIONAL
|
||||
//FISHEYE
|
||||
};
|
||||
|
||||
// an edge connects a camera and pattern
|
||||
struct edge
|
||||
{
|
||||
int cameraVertex; // vertex index for camera in this edge
|
||||
int photoVertex; // vertex index for pattern in this edge
|
||||
int photoIndex; // photo index among photos for this camera
|
||||
Mat transform; // transform from pattern to camera
|
||||
|
||||
edge(int cv, int pv, int pi, Mat trans)
|
||||
{
|
||||
cameraVertex = cv;
|
||||
photoVertex = pv;
|
||||
photoIndex = pi;
|
||||
transform = trans;
|
||||
}
|
||||
};
|
||||
|
||||
struct vertex
|
||||
{
|
||||
Mat pose; // relative pose to the first camera. For camera vertex, it is the
|
||||
// transform from the first camera to this camera, for pattern vertex,
|
||||
// it is the transform from pattern to the first camera
|
||||
int timestamp; // timestamp of photo, only available for photo vertex
|
||||
|
||||
vertex(Mat po, int ts)
|
||||
{
|
||||
pose = po;
|
||||
timestamp = ts;
|
||||
}
|
||||
|
||||
vertex()
|
||||
{
|
||||
pose = Mat::eye(4, 4, CV_32F);
|
||||
timestamp = -1;
|
||||
}
|
||||
};
|
||||
/* @brief Constructor
|
||||
@param cameraType camera type, PINHOLE or OMNIDIRECTIONAL
|
||||
@param nCameras number of cameras
|
||||
@fileName filename of string list that are used for calibration, the file is generated
|
||||
by imagelist_creator from OpenCv samples. The first one in the list is the pattern filename.
|
||||
@patternWidth the physical width of pattern, in user defined unit.
|
||||
@patternHeight the physical height of pattern, in user defined unit.
|
||||
@showExtration whether show extracted features and feature filtering.
|
||||
@nMiniMatches minimal number of matched features for a frame.
|
||||
@flags Calibration flags
|
||||
@criteria optimization stopping criteria.
|
||||
@detector feature detector that detect feature points in pattern and images.
|
||||
@descriptor feature descriptor.
|
||||
@matcher feature matcher.
|
||||
*/
|
||||
MultiCameraCalibration(int cameraType, int nCameras, const std::string& fileName, float patternWidth,
|
||||
float patternHeight, int verbose = 0, int showExtration = 0, int nMiniMatches = 20, int flags = 0,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 200, 1e-7),
|
||||
Ptr<FeatureDetector> detector = AKAZE::create(AKAZE::DESCRIPTOR_MLDB, 0, 3, 0.006f),
|
||||
Ptr<DescriptorExtractor> descriptor = AKAZE::create(AKAZE::DESCRIPTOR_MLDB,0, 3, 0.006f),
|
||||
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create("BruteForce-L1"));
|
||||
|
||||
/* @brief load images
|
||||
*/
|
||||
void loadImages();
|
||||
|
||||
/* @brief initialize multiple camera calibration. It calibrates each camera individually.
|
||||
*/
|
||||
void initialize();
|
||||
|
||||
/* @brief optimization extrinsic parameters
|
||||
*/
|
||||
double optimizeExtrinsics();
|
||||
|
||||
/* @brief run multi-camera camera calibration, it runs loadImage(), initialize() and optimizeExtrinsics()
|
||||
*/
|
||||
double run();
|
||||
|
||||
/* @brief write camera parameters to file.
|
||||
*/
|
||||
void writeParameters(const std::string& filename);
|
||||
|
||||
private:
|
||||
std::vector<std::string> readStringList();
|
||||
|
||||
int getPhotoVertex(int timestamp);
|
||||
|
||||
void graphTraverse(const Mat& G, int begin, std::vector<int>& order, std::vector<int>& pre);
|
||||
|
||||
void findRowNonZero(const Mat& row, Mat& idx);
|
||||
|
||||
void computeJacobianExtrinsic(const Mat& extrinsicParams, Mat& JTJ_inv, Mat& JTE);
|
||||
|
||||
void computePhotoCameraJacobian(const Mat& rvecPhoto, const Mat& tvecPhoto, const Mat& rvecCamera,
|
||||
const Mat& tvecCamera, Mat& rvecTran, Mat& tvecTran, const Mat& objectPoints, const Mat& imagePoints, const Mat& K,
|
||||
const Mat& distort, const Mat& xi, Mat& jacobianPhoto, Mat& jacobianCamera, Mat& E);
|
||||
|
||||
void compose_motion(InputArray _om1, InputArray _T1, InputArray _om2, InputArray _T2, Mat& om3, Mat& T3, Mat& dom3dom1,
|
||||
Mat& dom3dT1, Mat& dom3dom2, Mat& dom3dT2, Mat& dT3dom1, Mat& dT3dT1, Mat& dT3dom2, Mat& dT3dT2);
|
||||
|
||||
void JRodriguesMatlab(const Mat& src, Mat& dst);
|
||||
void dAB(InputArray A, InputArray B, OutputArray dABdA, OutputArray dABdB);
|
||||
|
||||
double computeProjectError(Mat& parameters);
|
||||
|
||||
void vector2parameters(const Mat& parameters, std::vector<Vec3f>& rvecVertex, std::vector<Vec3f>& tvecVertexs);
|
||||
void parameters2vector(const std::vector<Vec3f>& rvecVertex, const std::vector<Vec3f>& tvecVertex, Mat& parameters);
|
||||
|
||||
int _camType; //PINHOLE, FISHEYE or OMNIDIRECTIONAL
|
||||
int _nCamera;
|
||||
int _nMiniMatches;
|
||||
int _flags;
|
||||
int _verbose;
|
||||
double _error;
|
||||
float _patternWidth, _patternHeight;
|
||||
TermCriteria _criteria;
|
||||
std::string _filename;
|
||||
int _showExtraction;
|
||||
Ptr<FeatureDetector> _detector;
|
||||
Ptr<DescriptorExtractor> _descriptor;
|
||||
Ptr<DescriptorMatcher> _matcher;
|
||||
|
||||
std::vector<edge> _edgeList;
|
||||
std::vector<vertex> _vertexList;
|
||||
std::vector<std::vector<cv::Mat> > _objectPointsForEachCamera;
|
||||
std::vector<std::vector<cv::Mat> > _imagePointsForEachCamera;
|
||||
std::vector<cv::Mat> _cameraMatrix;
|
||||
std::vector<cv::Mat> _distortCoeffs;
|
||||
std::vector<cv::Mat> _xi;
|
||||
std::vector<std::vector<Mat> > _omEachCamera, _tEachCamera;
|
||||
};
|
||||
|
||||
//! @}
|
||||
|
||||
}} // namespace multicalib, cv
|
||||
#endif
|
||||
315
3rdparty/include/opencv2/ccalib/omnidir.hpp
vendored
Normal file
315
3rdparty/include/opencv2/ccalib/omnidir.hpp
vendored
Normal file
@@ -0,0 +1,315 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2015, Baisheng Lai (laibaisheng@gmail.com), Zhejiang University,
|
||||
// all rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's 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.
|
||||
//
|
||||
// * The name of the copyright holders may not 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 Intel Corporation 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.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_OMNIDIR_HPP__
|
||||
#define __OPENCV_OMNIDIR_HPP__
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/core/affine.hpp"
|
||||
#include <vector>
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace omnidir
|
||||
{
|
||||
//! @addtogroup ccalib
|
||||
//! @{
|
||||
|
||||
enum {
|
||||
CALIB_USE_GUESS = 1,
|
||||
CALIB_FIX_SKEW = 2,
|
||||
CALIB_FIX_K1 = 4,
|
||||
CALIB_FIX_K2 = 8,
|
||||
CALIB_FIX_P1 = 16,
|
||||
CALIB_FIX_P2 = 32,
|
||||
CALIB_FIX_XI = 64,
|
||||
CALIB_FIX_GAMMA = 128,
|
||||
CALIB_FIX_CENTER = 256
|
||||
};
|
||||
|
||||
enum{
|
||||
RECTIFY_PERSPECTIVE = 1,
|
||||
RECTIFY_CYLINDRICAL = 2,
|
||||
RECTIFY_LONGLATI = 3,
|
||||
RECTIFY_STEREOGRAPHIC = 4
|
||||
};
|
||||
|
||||
enum{
|
||||
XYZRGB = 1,
|
||||
XYZ = 2
|
||||
};
|
||||
/**
|
||||
* This module was accepted as a GSoC 2015 project for OpenCV, authored by
|
||||
* Baisheng Lai, mentored by Bo Li.
|
||||
*/
|
||||
|
||||
/** @brief Projects points for omnidirectional camera using CMei's model
|
||||
|
||||
@param objectPoints Object points in world coordinate, vector of vector of Vec3f or Mat of
|
||||
1xN/Nx1 3-channel of type CV_32F and N is the number of points. 64F is also acceptable.
|
||||
@param imagePoints Output array of image points, vector of vector of Vec2f or
|
||||
1xN/Nx1 2-channel of type CV_32F. 64F is also acceptable.
|
||||
@param rvec vector of rotation between world coordinate and camera coordinate, i.e., om
|
||||
@param tvec vector of translation between pattern coordinate and camera coordinate
|
||||
@param K Camera matrix \f$K = \vecthreethree{f_x}{s}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
|
||||
@param D Input vector of distortion coefficients \f$(k_1, k_2, p_1, p_2)\f$.
|
||||
@param xi The parameter xi for CMei's model
|
||||
@param jacobian Optional output 2Nx16 of type CV_64F jacobian matrix, contains the derivatives of
|
||||
image pixel points wrt parameters including \f$om, T, f_x, f_y, s, c_x, c_y, xi, k_1, k_2, p_1, p_2\f$.
|
||||
This matrix will be used in calibration by optimization.
|
||||
|
||||
The function projects object 3D points of world coordinate to image pixels, parameter by intrinsic
|
||||
and extrinsic parameters. Also, it optionally compute a by-product: the jacobian matrix containing
|
||||
contains the derivatives of image pixel points wrt intrinsic and extrinsic parameters.
|
||||
*/
|
||||
CV_EXPORTS_W void projectPoints(InputArray objectPoints, OutputArray imagePoints, InputArray rvec, InputArray tvec,
|
||||
InputArray K, double xi, InputArray D, OutputArray jacobian = noArray());
|
||||
|
||||
/** @overload */
|
||||
CV_EXPORTS void projectPoints(InputArray objectPoints, OutputArray imagePoints, const Affine3d& affine,
|
||||
InputArray K, double xi, InputArray D, OutputArray jacobian = noArray());
|
||||
|
||||
/** @brief Undistort 2D image points for omnidirectional camera using CMei's model
|
||||
|
||||
@param distorted Array of distorted image points, vector of Vec2f
|
||||
or 1xN/Nx1 2-channel Mat of type CV_32F, 64F depth is also acceptable
|
||||
@param K Camera matrix \f$K = \vecthreethree{f_x}{s}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
|
||||
@param D Distortion coefficients \f$(k_1, k_2, p_1, p_2)\f$.
|
||||
@param xi The parameter xi for CMei's model
|
||||
@param R Rotation trainsform between the original and object space : 3x3 1-channel, or vector: 3x1/1x3
|
||||
1-channel or 1x1 3-channel
|
||||
@param undistorted array of normalized object points, vector of Vec2f/Vec2d or 1xN/Nx1 2-channel Mat with the same
|
||||
depth of distorted points.
|
||||
*/
|
||||
CV_EXPORTS_W void undistortPoints(InputArray distorted, OutputArray undistorted, InputArray K, InputArray D, InputArray xi, InputArray R);
|
||||
|
||||
/** @brief Computes undistortion and rectification maps for omnidirectional camera image transform by a rotation R.
|
||||
It output two maps that are used for cv::remap(). If D is empty then zero distortion is used,
|
||||
if R or P is empty then identity matrices are used.
|
||||
|
||||
@param K Camera matrix \f$K = \vecthreethree{f_x}{s}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$, with depth CV_32F or CV_64F
|
||||
@param D Input vector of distortion coefficients \f$(k_1, k_2, p_1, p_2)\f$, with depth CV_32F or CV_64F
|
||||
@param xi The parameter xi for CMei's model
|
||||
@param R Rotation transform between the original and object space : 3x3 1-channel, or vector: 3x1/1x3, with depth CV_32F or CV_64F
|
||||
@param P New camera matrix (3x3) or new projection matrix (3x4)
|
||||
@param size Undistorted image size.
|
||||
@param m1type Type of the first output map that can be CV_32FC1 or CV_16SC2 . See convertMaps()
|
||||
for details.
|
||||
@param map1 The first output map.
|
||||
@param map2 The second output map.
|
||||
@param flags Flags indicates the rectification type, RECTIFY_PERSPECTIVE, RECTIFY_CYLINDRICAL, RECTIFY_LONGLATI and RECTIFY_STEREOGRAPHIC
|
||||
are supported.
|
||||
*/
|
||||
CV_EXPORTS_W void initUndistortRectifyMap(InputArray K, InputArray D, InputArray xi, InputArray R, InputArray P, const cv::Size& size,
|
||||
int m1type, OutputArray map1, OutputArray map2, int flags);
|
||||
|
||||
/** @brief Undistort omnidirectional images to perspective images
|
||||
|
||||
@param distorted The input omnidirectional image.
|
||||
@param undistorted The output undistorted image.
|
||||
@param K Camera matrix \f$K = \vecthreethree{f_x}{s}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
|
||||
@param D Input vector of distortion coefficients \f$(k_1, k_2, p_1, p_2)\f$.
|
||||
@param xi The parameter xi for CMei's model.
|
||||
@param flags Flags indicates the rectification type, RECTIFY_PERSPECTIVE, RECTIFY_CYLINDRICAL, RECTIFY_LONGLATI and RECTIFY_STEREOGRAPHIC
|
||||
@param Knew Camera matrix of the distorted image. If it is not assigned, it is just K.
|
||||
@param new_size The new image size. By default, it is the size of distorted.
|
||||
@param R Rotation matrix between the input and output images. By default, it is identity matrix.
|
||||
*/
|
||||
CV_EXPORTS_W void undistortImage(InputArray distorted, OutputArray undistorted, InputArray K, InputArray D, InputArray xi, int flags,
|
||||
InputArray Knew = cv::noArray(), const Size& new_size = Size(), InputArray R = Mat::eye(3, 3, CV_64F));
|
||||
|
||||
/** @brief Perform omnidirectional camera calibration, the default depth of outputs is CV_64F.
|
||||
|
||||
@param objectPoints Vector of vector of Vec3f object points in world (pattern) coordinate.
|
||||
It also can be vector of Mat with size 1xN/Nx1 and type CV_32FC3. Data with depth of 64_F is also acceptable.
|
||||
@param imagePoints Vector of vector of Vec2f corresponding image points of objectPoints. It must be the same
|
||||
size and the same type with objectPoints.
|
||||
@param size Image size of calibration images.
|
||||
@param K Output calibrated camera matrix.
|
||||
@param xi Output parameter xi for CMei's model
|
||||
@param D Output distortion parameters \f$(k_1, k_2, p_1, p_2)\f$
|
||||
@param rvecs Output rotations for each calibration images
|
||||
@param tvecs Output translation for each calibration images
|
||||
@param flags The flags that control calibrate
|
||||
@param criteria Termination criteria for optimization
|
||||
@param idx Indices of images that pass initialization, which are really used in calibration. So the size of rvecs is the
|
||||
same as idx.total().
|
||||
*/
|
||||
CV_EXPORTS_W double calibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, Size size,
|
||||
InputOutputArray K, InputOutputArray xi, InputOutputArray D, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
|
||||
int flags, TermCriteria criteria, OutputArray idx=noArray());
|
||||
|
||||
/** @brief Stereo calibration for omnidirectional camera model. It computes the intrinsic parameters for two
|
||||
cameras and the extrinsic parameters between two cameras. The default depth of outputs is CV_64F.
|
||||
|
||||
@param objectPoints Object points in world (pattern) coordinate. Its type is vector<vector<Vec3f> >.
|
||||
It also can be vector of Mat with size 1xN/Nx1 and type CV_32FC3. Data with depth of 64_F is also acceptable.
|
||||
@param imagePoints1 The corresponding image points of the first camera, with type vector<vector<Vec2f> >.
|
||||
It must be the same size and the same type as objectPoints.
|
||||
@param imagePoints2 The corresponding image points of the second camera, with type vector<vector<Vec2f> >.
|
||||
It must be the same size and the same type as objectPoints.
|
||||
@param imageSize1 Image size of calibration images of the first camera.
|
||||
@param imageSize2 Image size of calibration images of the second camera.
|
||||
@param K1 Output camera matrix for the first camera.
|
||||
@param xi1 Output parameter xi of Mei's model for the first camera
|
||||
@param D1 Output distortion parameters \f$(k_1, k_2, p_1, p_2)\f$ for the first camera
|
||||
@param K2 Output camera matrix for the first camera.
|
||||
@param xi2 Output parameter xi of CMei's model for the second camera
|
||||
@param D2 Output distortion parameters \f$(k_1, k_2, p_1, p_2)\f$ for the second camera
|
||||
@param rvec Output rotation between the first and second camera
|
||||
@param tvec Output translation between the first and second camera
|
||||
@param rvecsL Output rotation for each image of the first camera
|
||||
@param tvecsL Output translation for each image of the first camera
|
||||
@param flags The flags that control stereoCalibrate
|
||||
@param criteria Termination criteria for optimization
|
||||
@param idx Indices of image pairs that pass initialization, which are really used in calibration. So the size of rvecs is the
|
||||
same as idx.total().
|
||||
@
|
||||
*/
|
||||
CV_EXPORTS_W double stereoCalibrate(InputOutputArrayOfArrays objectPoints, InputOutputArrayOfArrays imagePoints1, InputOutputArrayOfArrays imagePoints2,
|
||||
const Size& imageSize1, const Size& imageSize2, InputOutputArray K1, InputOutputArray xi1, InputOutputArray D1, InputOutputArray K2, InputOutputArray xi2,
|
||||
InputOutputArray D2, OutputArray rvec, OutputArray tvec, OutputArrayOfArrays rvecsL, OutputArrayOfArrays tvecsL, int flags, TermCriteria criteria, OutputArray idx=noArray());
|
||||
|
||||
/** @brief Stereo rectification for omnidirectional camera model. It computes the rectification rotations for two cameras
|
||||
|
||||
@param R Rotation between the first and second camera
|
||||
@param T Translation between the first and second camera
|
||||
@param R1 Output 3x3 rotation matrix for the first camera
|
||||
@param R2 Output 3x3 rotation matrix for the second camera
|
||||
*/
|
||||
CV_EXPORTS_W void stereoRectify(InputArray R, InputArray T, OutputArray R1, OutputArray R2);
|
||||
|
||||
/** @brief Stereo 3D reconstruction from a pair of images
|
||||
|
||||
@param image1 The first input image
|
||||
@param image2 The second input image
|
||||
@param K1 Input camera matrix of the first camera
|
||||
@param D1 Input distortion parameters \f$(k_1, k_2, p_1, p_2)\f$ for the first camera
|
||||
@param xi1 Input parameter xi for the first camera for CMei's model
|
||||
@param K2 Input camera matrix of the second camera
|
||||
@param D2 Input distortion parameters \f$(k_1, k_2, p_1, p_2)\f$ for the second camera
|
||||
@param xi2 Input parameter xi for the second camera for CMei's model
|
||||
@param R Rotation between the first and second camera
|
||||
@param T Translation between the first and second camera
|
||||
@param flag Flag of rectification type, RECTIFY_PERSPECTIVE or RECTIFY_LONGLATI
|
||||
@param numDisparities The parameter 'numDisparities' in StereoSGBM, see StereoSGBM for details.
|
||||
@param SADWindowSize The parameter 'SADWindowSize' in StereoSGBM, see StereoSGBM for details.
|
||||
@param disparity Disparity map generated by stereo matching
|
||||
@param image1Rec Rectified image of the first image
|
||||
@param image2Rec rectified image of the second image
|
||||
@param newSize Image size of rectified image, see omnidir::undistortImage
|
||||
@param Knew New camera matrix of rectified image, see omnidir::undistortImage
|
||||
@param pointCloud Point cloud of 3D reconstruction, with type CV_64FC3
|
||||
@param pointType Point cloud type, it can be XYZRGB or XYZ
|
||||
*/
|
||||
CV_EXPORTS_W void stereoReconstruct(InputArray image1, InputArray image2, InputArray K1, InputArray D1, InputArray xi1,
|
||||
InputArray K2, InputArray D2, InputArray xi2, InputArray R, InputArray T, int flag, int numDisparities, int SADWindowSize,
|
||||
OutputArray disparity, OutputArray image1Rec, OutputArray image2Rec, const Size& newSize = Size(), InputArray Knew = cv::noArray(),
|
||||
OutputArray pointCloud = cv::noArray(), int pointType = XYZRGB);
|
||||
|
||||
namespace internal
|
||||
{
|
||||
void initializeCalibration(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, Size size, OutputArrayOfArrays omAll,
|
||||
OutputArrayOfArrays tAll, OutputArray K, double& xi, OutputArray idx = noArray());
|
||||
|
||||
void initializeStereoCalibration(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
|
||||
const Size& size1, const Size& size2, OutputArray om, OutputArray T, OutputArrayOfArrays omL, OutputArrayOfArrays tL, OutputArray K1, OutputArray D1, OutputArray K2, OutputArray D2,
|
||||
double &xi1, double &xi2, int flags, OutputArray idx);
|
||||
|
||||
void computeJacobian(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, InputArray parameters, Mat& JTJ_inv, Mat& JTE, int flags,
|
||||
double epsilon);
|
||||
|
||||
void computeJacobianStereo(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
|
||||
InputArray parameters, Mat& JTJ_inv, Mat& JTE, int flags, double epsilon);
|
||||
|
||||
void encodeParameters(InputArray K, InputArrayOfArrays omAll, InputArrayOfArrays tAll, InputArray distoaration, double xi, OutputArray parameters);
|
||||
|
||||
void encodeParametersStereo(InputArray K1, InputArray K2, InputArray om, InputArray T, InputArrayOfArrays omL, InputArrayOfArrays tL,
|
||||
InputArray D1, InputArray D2, double xi1, double xi2, OutputArray parameters);
|
||||
|
||||
void decodeParameters(InputArray paramsters, OutputArray K, OutputArrayOfArrays omAll, OutputArrayOfArrays tAll, OutputArray distoration, double& xi);
|
||||
|
||||
void decodeParametersStereo(InputArray parameters, OutputArray K1, OutputArray K2, OutputArray om, OutputArray T, OutputArrayOfArrays omL,
|
||||
OutputArrayOfArrays tL, OutputArray D1, OutputArray D2, double& xi1, double& xi2);
|
||||
|
||||
void estimateUncertainties(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, InputArray parameters, Mat& errors, Vec2d& std_error, double& rms, int flags);
|
||||
|
||||
void estimateUncertaintiesStereo(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, InputArray parameters, Mat& errors,
|
||||
Vec2d& std_error, double& rms, int flags);
|
||||
|
||||
double computeMeanReproErr(InputArrayOfArrays imagePoints, InputArrayOfArrays proImagePoints);
|
||||
|
||||
double computeMeanReproErr(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, InputArray K, InputArray D, double xi, InputArrayOfArrays omAll,
|
||||
InputArrayOfArrays tAll);
|
||||
|
||||
double computeMeanReproErrStereo(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, InputArray K1, InputArray K2,
|
||||
InputArray D1, InputArray D2, double xi1, double xi2, InputArray om, InputArray T, InputArrayOfArrays omL, InputArrayOfArrays TL);
|
||||
|
||||
void subMatrix(const Mat& src, Mat& dst, const std::vector<int>& cols, const std::vector<int>& rows);
|
||||
|
||||
void flags2idx(int flags, std::vector<int>& idx, int n);
|
||||
|
||||
void flags2idxStereo(int flags, std::vector<int>& idx, int n);
|
||||
|
||||
void fillFixed(Mat&G, int flags, int n);
|
||||
|
||||
void fillFixedStereo(Mat& G, int flags, int n);
|
||||
|
||||
double findMedian(const Mat& row);
|
||||
|
||||
Vec3d findMedian3(InputArray mat);
|
||||
|
||||
void getInterset(InputArray idx1, InputArray idx2, OutputArray inter1, OutputArray inter2, OutputArray inter_ori);
|
||||
|
||||
void compose_motion(InputArray _om1, InputArray _T1, InputArray _om2, InputArray _T2, Mat& om3, Mat& T3, Mat& dom3dom1,
|
||||
Mat& dom3dT1, Mat& dom3dom2, Mat& dom3dT2, Mat& dT3dom1, Mat& dT3dT1, Mat& dT3dom2, Mat& dT3dT2);
|
||||
|
||||
//void JRodriguesMatlab(const Mat& src, Mat& dst);
|
||||
|
||||
//void dAB(InputArray A, InputArray B, OutputArray dABdA, OutputArray dABdB);
|
||||
} // internal
|
||||
|
||||
//! @}
|
||||
|
||||
} // omnidir
|
||||
|
||||
} //cv
|
||||
#endif
|
||||
184
3rdparty/include/opencv2/ccalib/randpattern.hpp
vendored
Normal file
184
3rdparty/include/opencv2/ccalib/randpattern.hpp
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2015, Baisheng Lai (laibaisheng@gmail.com), Zhejiang University,
|
||||
// all rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's 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.
|
||||
//
|
||||
// * The name of the copyright holders may not 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 Intel Corporation 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.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_RANDOMPATTERN_HPP__
|
||||
#define __OPENCV_RANDOMPATTERN_HPP__
|
||||
|
||||
#include "opencv2/features2d.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
|
||||
namespace cv { namespace randpattern {
|
||||
|
||||
|
||||
//! @addtogroup ccalib
|
||||
//! @{
|
||||
|
||||
/** @brief Class for finding features points and corresponding 3D in world coordinate of
|
||||
a "random" pattern, which can be to be used in calibration. It is useful when pattern is
|
||||
partly occluded or only a part of pattern can be observed in multiple cameras calibration.
|
||||
The pattern can be generated by RandomPatternGenerator class described in this file.
|
||||
|
||||
Please refer to paper
|
||||
B. Li, L. Heng, K. Kevin and M. Pollefeys, "A Multiple-Camera System
|
||||
Calibration Toolbox Using A Feature Descriptor-Based Calibration
|
||||
Pattern", in IROS 2013.
|
||||
*/
|
||||
|
||||
class CV_EXPORTS RandomPatternCornerFinder
|
||||
{
|
||||
public:
|
||||
|
||||
/* @brief Construct RandomPatternCornerFinder object
|
||||
|
||||
@param patternWidth the real width of "random" pattern in a user defined unit.
|
||||
@param patternHeight the real height of "random" pattern in a user defined unit.
|
||||
@param nMiniMatch number of minimal matches, otherwise that image is abandoned
|
||||
@depth depth of output objectPoints and imagePoints, set it to be CV_32F or CV_64F.
|
||||
@showExtraction whether show feature extraction, 0 for no and 1 for yes.
|
||||
@detector feature detector to detect feature points in pattern and images.
|
||||
@descriptor feature descriptor.
|
||||
@matcher feature matcher.
|
||||
*/
|
||||
RandomPatternCornerFinder(float patternWidth, float patternHeight,
|
||||
int nminiMatch = 20, int depth = CV_32F, int verbose = 0, int showExtraction = 0,
|
||||
Ptr<FeatureDetector> detector = AKAZE::create(AKAZE::DESCRIPTOR_MLDB, 0, 3, 0.005f),
|
||||
Ptr<DescriptorExtractor> descriptor = AKAZE::create(AKAZE::DESCRIPTOR_MLDB,0, 3, 0.005f),
|
||||
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create("BruteForce-L1"));
|
||||
|
||||
/* @brief Load pattern image and compute features for pattern
|
||||
@param patternImage image for "random" pattern generated by RandomPatternGenerator, run it first.
|
||||
*/
|
||||
void loadPattern(const cv::Mat &patternImage);
|
||||
|
||||
/* @brief Load pattern and features
|
||||
@param patternImage image for "random" pattern generated by RandomPatternGenerator, run it first.
|
||||
@param patternKeyPoints keyPoints created from a FeatureDetector.
|
||||
@param patternDescriptors descriptors created from a DescriptorExtractor.
|
||||
*/
|
||||
void loadPattern(const cv::Mat &patternImage, const std::vector<cv::KeyPoint> &patternKeyPoints, const cv::Mat &patternDescriptors);
|
||||
|
||||
/* @brief Compute matched object points and image points which are used for calibration
|
||||
The objectPoints (3D) and imagePoints (2D) are stored inside the class. Run getObjectPoints()
|
||||
and getImagePoints() to get them.
|
||||
|
||||
@param inputImages vector of 8-bit grayscale images containing "random" pattern
|
||||
that are used for calibration.
|
||||
*/
|
||||
void computeObjectImagePoints(std::vector<cv::Mat> inputImages);
|
||||
|
||||
//void computeObjectImagePoints2(std::vector<cv::Mat> inputImages);
|
||||
|
||||
/* @brief Compute object and image points for a single image. It returns a vector<Mat> that
|
||||
the first element stores the imagePoints and the second one stores the objectPoints.
|
||||
|
||||
@param inputImage single input image for calibration
|
||||
*/
|
||||
std::vector<cv::Mat> computeObjectImagePointsForSingle(cv::Mat inputImage);
|
||||
|
||||
/* @brief Get object(3D) points
|
||||
*/
|
||||
const std::vector<cv::Mat> &getObjectPoints();
|
||||
|
||||
/* @brief and image(2D) points
|
||||
*/
|
||||
const std::vector<cv::Mat> &getImagePoints();
|
||||
|
||||
private:
|
||||
|
||||
std::vector<cv::Mat> _objectPonits, _imagePoints;
|
||||
float _patternWidth, _patternHeight;
|
||||
cv::Size _patternImageSize;
|
||||
int _nminiMatch;
|
||||
int _depth;
|
||||
int _verbose;
|
||||
|
||||
Ptr<FeatureDetector> _detector;
|
||||
Ptr<DescriptorExtractor> _descriptor;
|
||||
Ptr<DescriptorMatcher> _matcher;
|
||||
Mat _descriptorPattern;
|
||||
std::vector<cv::KeyPoint> _keypointsPattern;
|
||||
Mat _patternImage;
|
||||
int _showExtraction;
|
||||
|
||||
void keyPoints2MatchedLocation(const std::vector<cv::KeyPoint>& imageKeypoints,
|
||||
const std::vector<cv::KeyPoint>& patternKeypoints, const std::vector<cv::DMatch> matchces,
|
||||
cv::Mat& matchedImagelocation, cv::Mat& matchedPatternLocation);
|
||||
void getFilteredLocation(cv::Mat& imageKeypoints, cv::Mat& patternKeypoints, const cv::Mat mask);
|
||||
void getObjectImagePoints(const cv::Mat& imageKeypoints, const cv::Mat& patternKeypoints);
|
||||
void crossCheckMatching( cv::Ptr<DescriptorMatcher>& descriptorMatcher,
|
||||
const Mat& descriptors1, const Mat& descriptors2,
|
||||
std::vector<DMatch>& filteredMatches12, int knn=1 );
|
||||
void drawCorrespondence(const Mat& image1, const std::vector<cv::KeyPoint> keypoint1,
|
||||
const Mat& image2, const std::vector<cv::KeyPoint> keypoint2, const std::vector<cv::DMatch> matchces,
|
||||
const Mat& mask1, const Mat& mask2, const int step);
|
||||
};
|
||||
|
||||
/* @brief Class to generate "random" pattern image that are used for RandomPatternCornerFinder
|
||||
Please refer to paper
|
||||
B. Li, L. Heng, K. Kevin and M. Pollefeys, "A Multiple-Camera System
|
||||
Calibration Toolbox Using A Feature Descriptor-Based Calibration
|
||||
Pattern", in IROS 2013.
|
||||
*/
|
||||
class CV_EXPORTS RandomPatternGenerator
|
||||
{
|
||||
public:
|
||||
/* @brief Construct RandomPatternGenerator
|
||||
|
||||
@param imageWidth image width of the generated pattern image
|
||||
@param imageHeight image height of the generated pattern image
|
||||
*/
|
||||
RandomPatternGenerator(int imageWidth, int imageHeight);
|
||||
|
||||
/* @brief Generate pattern
|
||||
*/
|
||||
void generatePattern();
|
||||
/* @brief Get pattern
|
||||
*/
|
||||
cv::Mat getPattern();
|
||||
private:
|
||||
cv::Mat _pattern;
|
||||
int _imageWidth, _imageHeight;
|
||||
};
|
||||
|
||||
//! @}
|
||||
|
||||
}} //namespace randpattern, cv
|
||||
#endif
|
||||
@@ -50,6 +50,7 @@
|
||||
#endif
|
||||
|
||||
#include "opencv2/core/cvdef.h"
|
||||
#include "opencv2/core/version.hpp"
|
||||
#include "opencv2/core/base.hpp"
|
||||
#include "opencv2/core/cvstd.hpp"
|
||||
#include "opencv2/core/traits.hpp"
|
||||
@@ -587,21 +587,6 @@ _AccTp normInf(const _Tp* a, const _Tp* b, int n)
|
||||
*/
|
||||
CV_EXPORTS_W float cubeRoot(float val);
|
||||
|
||||
/** @overload
|
||||
|
||||
cubeRoot with argument of `double` type calls `std::cbrt(double)` (C++11) or falls back on `pow()` for C++98 compilation mode.
|
||||
*/
|
||||
static inline
|
||||
double cubeRoot(double val)
|
||||
{
|
||||
#ifdef CV_CXX11
|
||||
return std::cbrt(val);
|
||||
#else
|
||||
double v = pow(abs(val), 1/3.); // pow doesn't support negative inputs with fractional exponents
|
||||
return val >= 0 ? v : -v;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @brief Calculates the angle of a 2D vector in degrees.
|
||||
|
||||
The function fastAtan2 calculates the full-range angle of an input 2D vector. The angle is measured
|
||||
@@ -7,9 +7,6 @@
|
||||
|
||||
#include <opencv2/core/async.hpp>
|
||||
#include <opencv2/core/detail/async_promise.hpp>
|
||||
#include <opencv2/core/utils/logger.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace cv { namespace utils {
|
||||
//! @addtogroup core_utils
|
||||
@@ -67,61 +64,6 @@ String dumpString(const String& argument)
|
||||
return cv::format("String: %s", argument.c_str());
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
String testOverloadResolution(int value, const Point& point = Point(42, 24))
|
||||
{
|
||||
return format("overload (int=%d, point=(x=%d, y=%d))", value, point.x,
|
||||
point.y);
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
String testOverloadResolution(const Rect& rect)
|
||||
{
|
||||
return format("overload (rect=(x=%d, y=%d, w=%d, h=%d))", rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
String dumpRect(const Rect& argument)
|
||||
{
|
||||
return format("rect: (x=%d, y=%d, w=%d, h=%d)", argument.x, argument.y,
|
||||
argument.width, argument.height);
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
String dumpTermCriteria(const TermCriteria& argument)
|
||||
{
|
||||
return format("term_criteria: (type=%d, max_count=%d, epsilon=%lf",
|
||||
argument.type, argument.maxCount, argument.epsilon);
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
String dumpRotatedRect(const RotatedRect& argument)
|
||||
{
|
||||
return format("rotated_rect: (c_x=%f, c_y=%f, w=%f, h=%f, a=%f)",
|
||||
argument.center.x, argument.center.y, argument.size.width,
|
||||
argument.size.height, argument.angle);
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
String dumpRange(const Range& argument)
|
||||
{
|
||||
if (argument == Range::all())
|
||||
{
|
||||
return "range: all";
|
||||
}
|
||||
else
|
||||
{
|
||||
return format("range: (s=%d, e=%d)", argument.start, argument.end);
|
||||
}
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
void testRaiseGeneralException()
|
||||
{
|
||||
throw std::runtime_error("exception text");
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
AsyncArray testAsyncArray(InputArray argument)
|
||||
{
|
||||
@@ -145,26 +87,7 @@ AsyncArray testAsyncException()
|
||||
return p.getArrayResult();
|
||||
}
|
||||
|
||||
//! @} // core_utils
|
||||
} // namespace cv::utils
|
||||
|
||||
//! @cond IGNORED
|
||||
|
||||
CV_WRAP static inline
|
||||
int setLogLevel(int level)
|
||||
{
|
||||
// NB: Binding generators doesn't work with enums properly yet, so we define separate overload here
|
||||
return cv::utils::logging::setLogLevel((cv::utils::logging::LogLevel)level);
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
int getLogLevel()
|
||||
{
|
||||
return cv::utils::logging::getLogLevel();
|
||||
}
|
||||
|
||||
//! @endcond IGNORED
|
||||
|
||||
} // namespaces cv / utils
|
||||
//! @}
|
||||
}} // namespace
|
||||
|
||||
#endif // OPENCV_CORE_BINDINGS_UTILS_HPP
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user