1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <math.h>
#include <string.h>
#define EXPORT_API __declspec(dllexport)
using namespace cv;
using namespace std;
class BhBlocks
{
private:
int colCount, rowCount;
float colSize, rowSize;
CvRect rct;
void compute();
public:
vector<vector<CvRect>> rects;
void setColsRowsCount(int colCount, int rowCount);
void setColRowSize(float colSize, float rowSize);
void setRect(IplImage* srcImage);
void setRect(const CvRect& srcRect);
int getColCount();
int getRowCount();
float getColSize();
float getRowSize();
BhBlocks(const IplImage* srcImage, float colSize = -1, float rowSize = -1, int colCount = -1, int rowCount = -1);
BhBlocks(const Mat& srcMat, float colSize = -1, float rowSize = -1, int colCount = -1, int rowCount = -1);
BhBlocks(const CvRect& srcImage, float colSize = -1, float rowSize = -1, int colCount = -1, int rowCount = -1);
void drawBlocks(Mat srcImage, Scalar color, int thickness);
void displayBlocks(char* title, IplImage* srcImage, CvScalar color, int thickness);
vector<Rect> getRects();
};
|