-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathquadTree.cpp
More file actions
22 lines (19 loc) · 857 Bytes
/
Copy pathquadTree.cpp
File metadata and controls
22 lines (19 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//
// Created by Zhiyuan Wang on 18/06/2017.
//
#include "quadTree.h"
quadTree::quadTree(const Mat &img, Rect roi, double threshold, int min_granular_size) {
this->mVector = colorHistVector(img, roi);
this->similarity_threshold = threshold;
int x = roi.x, y = roi.y;
int w = roi.width, h = roi.height;
if(w/2 >= min_granular_size && h/2 >= min_granular_size){
this->upleft = new quadTree(img, Rect(x, y, w/2, h/2), threshold, min_granular_size);
this->upright = new quadTree(img, Rect(x+w/2, 0, w-w/2, h/2), threshold, min_granular_size);
this->downleft = new quadTree(img, Rect(x, y+h/2, w/2, h-h/2), threshold, min_granular_size);
this->downright = new quadTree(img, Rect(x+w/2, y+h/2, w-w/2, h-h/2), min_granular_size);
}
}
colorHistVector* quadTree::getVector() {
return &(this->mVector);
}