Revision 710
Tweaked vision and various colonet fixes
vision.c | ||
---|---|---|
14 | 14 |
#include <stdio.h> |
15 | 15 |
#include <stdlib.h> |
16 | 16 |
|
17 |
#define MINH 100 //min threshold level
|
|
18 |
#define MAXH 150 //max threshold level
|
|
17 |
#define MINH 50 //min threshold level
|
|
18 |
#define MAXH 75 //max threshold level
|
|
19 | 19 |
|
20 |
#define MIN_BOX_WIDTH 10 |
|
21 |
#define MAX_BOX_WIDTH 20 |
|
22 |
#define MIN_BOX_HEIGHT 10 |
|
23 |
#define MAX_BOX_HEIGHT 20 |
|
24 |
|
|
25 |
#define BEST_CENTER_PADDING_X 9 |
|
26 |
#define BEST_CENTER_PADDING_Y 9 |
|
27 |
|
|
28 |
#define ELLIPSE_COUNT_TO_BE_OBJECT 7 |
|
29 |
|
|
20 | 30 |
#define DEBUG 0 //Debug to find threshold level |
21 | 31 |
|
22 | 32 |
struct CenterP { |
... | ... | |
100 | 110 |
size.height = cvRound(box->size.height*0.5); |
101 | 111 |
box->angle = -box->angle; |
102 | 112 |
|
103 |
if (size.width>10&&size.height>10&&size.width<20&&size.height<20){ |
|
113 |
if (size.width > MIN_BOX_WIDTH && size.height > MIN_BOX_HEIGHT |
|
114 |
&& size.width < MAX_BOX_WIDTH && size.height < MAX_BOX_HEIGHT){ |
|
104 | 115 |
//printf("%d %d %d %d\n",center.x,center.y,size.width,size.height); |
105 | 116 |
|
106 | 117 |
int found=0, j; |
107 | 118 |
for (j = 0; j < index; j++) { |
108 |
if (abs(bestc[j].center.x-center.x)<9&&abs(bestc[j].center.y-center.y)<9) { |
|
119 |
if (abs(bestc[j].center.x-center.x) < BEST_CENTER_PADDING_X |
|
120 |
&& abs(bestc[j].center.y-center.y) < BEST_CENTER_PADDING_Y) { |
|
109 | 121 |
bestc[j].count++; |
110 | 122 |
found=1; |
111 | 123 |
break; |
... | ... | |
133 | 145 |
int count = 0; |
134 | 146 |
int i; |
135 | 147 |
for (i = 0; i < index; i++) { |
136 |
if (bestc[i].count > 7){
|
|
148 |
if (bestc[i].count > ELLIPSE_COUNT_TO_BE_OBJECT){
|
|
137 | 149 |
count++; |
138 | 150 |
} |
139 | 151 |
} |
... | ... | |
146 | 158 |
|
147 | 159 |
int c = 0; |
148 | 160 |
for (i = 0; i < index; i++) { |
149 |
if (bestc[i].count > 7){
|
|
161 |
if (bestc[i].count > ELLIPSE_COUNT_TO_BE_OBJECT){
|
|
150 | 162 |
pos_array[c].x = bestc[i].center.x; |
151 | 163 |
pos_array[c].y = bestc[i].center.y; |
152 | 164 |
c++; |
Also available in: Unified diff