39 #define Img(X,Y)(source[(Y)*input->w*2+(X)*2+1])
40 #define Out(X,Y)(source[(Y)*input->w*2+(X)*2])
55 marker_deviation.
x = 0;
56 marker_deviation.
y = 0;
57 marker_deviation.
inlier = 0;
63 source = (
uint8_t *) input->buf;
69 for (j = M; j < (input->h - M); j++) {
70 for (i = M; i < (input->w - M); i++) {
73 for (k = 1; k < M; k+=2) {
82 good +=
AbsDiff(
Img(i - k, j - k) +
Img(i + k, j + k),
Img(i + k, j - k) +
Img(i - k, j + k));
85 for (k = 4; k < M; k += 2) {
87 bad +=
AbsDiff(
Img(i - k, j - k / 2) ,
Img(i + k, j + k / 2));
88 bad +=
AbsDiff(
Img(i + k / 2, j - k) ,
Img(i - k / 2, j + k));
89 bad +=
AbsDiff(
Img(i - k / 2, j - k) ,
Img(i + k / 2, j + k));
90 bad +=
AbsDiff(
Img(i + k, j - k / 2) ,
Img(i - k, j + k / 2));
93 good +=
AbsDiff(
Img(i - k, j - k / 2) +
Img(i + k, j + k / 2),
Img(i + k / 2, j - k) +
Img(i - k / 2, j + k));
94 good +=
AbsDiff(
Img(i - k / 2, j - k) +
Img(i + k / 2, j + k),
Img(i + k, j - k / 2) +
Img(i - k, j + k / 2));
115 int px = maxx & 0xFFFe;
116 int py = maxy & 0xFFFe;
118 for (
y = 0;
y < input->h-1;
y++) {
122 for (x = 0; x < input->w-1; x+=2) {
127 marker_deviation.
x = maxx;
128 marker_deviation.
y = maxy;
129 marker_deviation.
inlier = 0;
132 return marker_deviation;
int AbsDiff(int A, int B)
#define Img(X, Y)
Find the marker location.
struct marker_deviation_t marker(struct image_t *input, uint8_t M)
if(PrimarySpektrumState.SpektrumTimer)