bazar  1.3.1
image_class_example.cpp
Go to the documentation of this file.
1 /*
2 Copyright 2005, 2006 Computer Vision Lab,
3 Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland.
4 All rights reserved.
5 
6 This file is part of BazAR.
7 
8 BazAR is free software; you can redistribute it and/or modify it under the
9 terms of the GNU General Public License as published by the Free Software
10 Foundation; either version 2 of the License, or (at your option) any later
11 version.
12 
13 BazAR is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License along with
18 BazAR; if not, write to the Free Software Foundation, Inc., 51 Franklin
19 Street, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21 #include <iostream>
22 using namespace std;
23 
24 #include "image/mcv.h"
25 #include "image_class_example.h"
26 
28  float u, float v, float scale,
29  object_view * ov,
30  int patch_size)
31 {
32  point2d = new keypoint; //< TODO: delete this keypoint somewhere.
33  point2d->u = u;
34  point2d->v = v;
35  point2d->scale = scale;
36  preprocessed = cvCreateImage(cvSize(patch_size, patch_size), IPL_DEPTH_8U, 1);
37 
38  view = ov;
39 
40  class_index = _class_index;
41 
42  original_image = 0;
43 }
44 
45 image_class_example::image_class_example(int p_class_index, IplImage * image)
46 {
47  class_index = p_class_index;
48  point2d = 0;
49 
50  original_image = cvCloneImage(image);
51 }
52 
54 {
55  point2d = 0;
56  original_image = 0;
57  preprocessed = 0;
58  view = 0;
59 }
60 
62 {
63  if (preprocessed) cvReleaseImage(&preprocessed);
64  if (original_image) cvReleaseImage(&original_image);
65 }
66 
68  preprocessed = cvCreateImage(cvSize(sz, sz), IPL_DEPTH_8U, 1);
69 }
70