File: ContourUtility.hh

package info (click to toggle)
exactimage 1.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,048 kB
  • sloc: cpp: 35,940; ansic: 1,952; xml: 1,447; makefile: 338; perl: 138; sh: 110; python: 45; php: 37; ruby: 12
file content (47 lines) | stat: -rw-r--r-- 1,886 bytes parent folder | download | duplicates (11)
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
42
43
44
45
46
47
#include "Contours.hh"

void CenterAndReduce(const Contours::Contour& source,
		     Contours::Contour& dest,
		     unsigned int shift, // integer coordinate bit reduction
		     double& drx, // returned centroid
		     double& dry  // returned centroid
		     );

void RotCenterAndReduce(const Contours::Contour& source,
			Contours::Contour& dest,
			double phi, // clockwise rotation in radians
			unsigned int add, // added to all coordinates to avoid negative values,
                                          // should be at least image diagonal length
			unsigned int shift, // integer coordinate bit reduction
			double& drx, // returned centroid 
			double& dry  // returned centroid
			);

// realy fast summation of minimum L1-distance
double L1Dist(const Contours::Contour& a,
	      const Contours::Contour& b,
	      double drxa, // a centroid
	      double drxb, // a centroid
	      double drya, // b centroid
	      double dryb, // b centroid
	      unsigned int shift,   // reduction bits (in case a and b are reduced) or 0
	      double& transx, // returned translation for a
	      double& transy  // returned translation for a
	      );

// plot contour in specified color
// c coordinates must not be outside image range
void DrawContour(Image& img, const Contours::Contour& c, unsigned int r, unsigned int g, unsigned int b);

// plot translated contour
// c coordinates may lie outside image
void DrawTContour(Image& img, const Contours::Contour& c, unsigned int tx, unsigned int ty, unsigned int r, unsigned int g, unsigned int b);


// functions to cache preprocessed contours on disk
bool WriteContour(FILE* f, const Contours::Contour& source);
bool ReadContour(FILE* f, Contours::Contour& dest);

bool WriteContourArray(FILE* f, const std::vector <Contours::Contour*>& contours);
bool ReadContourArray(FILE* f, std::vector <Contours::Contour*>& contours);