Revision 467
fixed vision more
vision.c | ||
---|---|---|
24 | 24 |
}; |
25 | 25 |
|
26 | 26 |
static IplImage *image02, *image03, *image04; |
27 |
static char* filename; |
|
27 | 28 |
|
28 |
int vision_init(const char* filename) { |
|
29 |
int vision_init(char* filename_) { |
|
30 |
filename = filename_; |
|
31 |
return 0; |
|
32 |
} |
|
33 |
|
|
34 |
int vision_get_robot_positions(VisionPosition** positions) { |
|
35 |
CvMemStorage* stor; |
|
36 |
CvSeq* cont; |
|
37 |
CvBox2D32f* box; |
|
38 |
CvPoint* PointArray; |
|
39 |
CvPoint2D32f* PointArray2D32f; |
|
40 |
|
|
29 | 41 |
if ((image03 = cvLoadImage(filename, 0)) == 0) { |
30 | 42 |
fprintf(stderr, "Failed to load image.\n"); |
31 | 43 |
return -1; |
... | ... | |
43 | 55 |
|
44 | 56 |
if (DEBUG) cvNamedWindow("Result", 1); |
45 | 57 |
|
46 |
return 0; |
|
47 |
} |
|
48 |
|
|
49 |
void vision_destroy() { |
|
50 |
if (DEBUG) cvWaitKey(0); |
|
51 |
|
|
52 |
cvReleaseImage(&image02); |
|
53 |
cvReleaseImage(&image03); |
|
54 |
|
|
55 |
if (DEBUG) cvDestroyWindow("Result"); |
|
56 |
} |
|
57 |
|
|
58 |
int vision_get_robot_positions(VisionPosition** positions) { |
|
59 |
CvMemStorage* stor; |
|
60 |
CvSeq* cont; |
|
61 |
CvBox2D32f* box; |
|
62 |
CvPoint* PointArray; |
|
63 |
CvPoint2D32f* PointArray2D32f; |
|
64 |
|
|
65 | 58 |
// Create dynamic structure and sequence. |
66 | 59 |
stor = cvCreateMemStorage(0); |
67 | 60 |
cont = cvCreateSeq(CV_SEQ_ELTYPE_POINT, sizeof(CvSeq), sizeof(CvPoint) , stor); |
... | ... | |
172 | 165 |
} |
173 | 166 |
} |
174 | 167 |
|
168 |
if (DEBUG) cvWaitKey(0); |
|
169 |
|
|
170 |
cvReleaseImage(&image02); |
|
171 |
cvReleaseImage(&image03); |
|
172 |
|
|
173 |
if (DEBUG) cvDestroyWindow("Result"); |
|
174 |
|
|
175 | 175 |
// Show image. HighGUI use. |
176 | 176 |
if (DEBUG) cvShowImage( "Result", image04 ); |
177 | 177 |
|
Also available in: Unified diff