-
Notifications
You must be signed in to change notification settings - Fork 0
/
imgproc.h
74 lines (50 loc) · 1.5 KB
/
imgproc.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef _IMGPROC_H_
#define _IMGPROC_H_
#include <SDL/SDL.h>
// forward declarations of internal types
struct Buffer;
typedef struct {
unsigned int width;
unsigned int height;
char * name;
int handle;
struct Buffer * buffers;
unsigned int n_buffers;
} Camera;
typedef struct {
unsigned int width;
unsigned int height;
char * data;
char * mem_ptr;
SDL_Surface * sdl_surface;
} Image;
typedef struct {
unsigned int width;
unsigned int height;
SDL_Surface * screen;
} Viewer;
/* Utility operations */
void init_imgproc();
void quit_imgproc();
void waitTime(size_t milliseconds);
/* Webcam operations */
Camera * camOpen(unsigned int width, unsigned int height);
unsigned int camGetWidth(Camera * cam);
unsigned int camGetHeight(Camera * cam);
Image * camGrabImage(Camera * cam);
void camClose(Camera * cam);
/* Image operations */
Image * imgNew(unsigned int width, unsigned int height);
Image * imgFromBitmap(const char * filename);
Image * imgCopy(Image * img);
void imgDestroy(Image * img);
unsigned int imgGetWidth(Image * img);
unsigned int imgGetHeight(Image * img);
void imgSetPixel(Image * img, unsigned int x, unsigned int y, char r, char g, char b);
char * imgGetPixel(Image * img, unsigned int x, unsigned int y);
//PyObject * imgPixel(Image * img, unsigned int x, unsigned int y);
/* Viewer operations */
Viewer * viewOpen(unsigned int width, unsigned int height, const char * title);
void viewDisplayImage(Viewer * view, Image * img);
void viewClose(Viewer * view);
#endif // _IMGPROC_H_