OpenCV

From ImageWiki

(Difference between revisions)
Jump to: navigation, search
Line 23: Line 23:
= Eksempel 2 =
= Eksempel 2 =
Tag billeder, find kanter og vis dem.
Tag billeder, find kanter og vis dem.
 +
 +
= Tips og tricks =
 +
 +
 +
== Tilgang til pixels ==
 +
 +
#define GRAY(IMAGE, X, Y) \
 +
    ((uchar*)((IMAGE)->imageData  + (IMAGE)->widthStep*(Y)))[X]
 +
#define RED(IMAGE, X, Y) \
 +
    ((uchar*)((IMAGE)->imageData + (IMAGE)->widthStep*(Y)))[(X)*3+2]
 +
#define GREEN(IMAGE, X, Y) \
 +
    ((uchar*)((IMAGE)->imageData + (IMAGE)->widthStep*(Y)))[(X)*3+1]
 +
#define BLUE(IMAGE, X, Y) \
 +
    ((uchar*)((IMAGE)->imageData + (IMAGE)->widthStep*(Y)))[(X)*3]
 +
 +
 +
int tmp = GRAY(I, x, y);
 +
GRAY(I, x, y) = tmp + 1;
 +
 +
 +
int red = RED(RGB, x, y);
 +
BLUE(RGB, x, y) = red;
 +
= Propaganda =
= Propaganda =

Revision as of 10:10, 9 July 2006

Personal tools