Kreuzkorrelation nicht mehr mit Rot-Kanal, sondern auf dem Grau-Bild (R+G+B)

test16bit
Stefan Jahn 4 years ago
parent fd921718e4
commit e75e2adedf

@ -213,7 +213,7 @@ void Detect::InputDetect(int *posx, int *posy) {
}
}
inline float calc_vector(uint8_t a1, uint8_t a2, uint8_t b1, uint8_t b2, uint8_t c1, uint8_t c2, uint8_t d1, uint8_t d2) {
inline float calc_vector(uint16_t a1, uint16_t a2, uint16_t b1, uint16_t b2, uint16_t c1, uint16_t c2, uint16_t d1, uint16_t d2) {
return a1 * a2 + b1 * b2 + c1 * c2 + d1 * d2;
// __m64 m1 = _mm_set_pi16 (a1, b1, c1, d1);
// __m64 m2 = _mm_set_pi16 (a2, b2, c2, d2);
@ -223,7 +223,7 @@ inline float calc_vector(uint8_t a1, uint8_t a2, uint8_t b1, uint8_t b2, uint8_t
// return data[0] + data[1];
}
#define OBJSIZE 50
#define OBJSIZE 52
#define MAXSHIFT 20
void Detect::InputDetectCrossC(int *posx, int *posy) {
unsigned char *pxi; // input image
@ -271,10 +271,20 @@ void Detect::InputDetectCrossC(int *posx, int *posy) {
for (x = 0; x < OBJSIZE; x++, oldi += 3, ini += 3, oldx++, inx++) {
if (oldx >= 0 && oldy >= 0 && oldx < oldFrame.w && oldy <= oldFrame.h &&
inx >= 0 && inx < inFrame.w && iny >= 0 && iny < inFrame.h) {
f += calc_vector( pxo[oldi+0], pxi[ini+0],
pxo[oldi+3], pxi[ini+3],
pxo[oldi+6], pxi[ini+6],
pxo[oldi+9], pxi[ini+9]);
uint16_t ogray[4];
uint16_t igray[4];
ogray[0] = pxo[oldi+0] + pxo[oldi+1] + pxo[oldi+2];
ogray[1] = pxo[oldi+3] + pxo[oldi+4] + pxo[oldi+5];
ogray[2] = pxo[oldi+6] + pxo[oldi+7] + pxo[oldi+8];
ogray[3] = pxo[oldi+9] + pxo[oldi+10] + pxo[oldi+11];
igray[0] = pxi[oldi+0] + pxi[ini+1] + pxi[ini+2];
igray[1] = pxi[oldi+3] + pxi[ini+4] + pxi[ini+5];
igray[2] = pxi[oldi+6] + pxi[ini+7] + pxi[ini+8];
igray[3] = pxi[oldi+9] + pxi[ini+10] + pxi[ini+11];
f += calc_vector( ogray[0], igray[0],
ogray[1], igray[1],
ogray[2], igray[2],
ogray[3], igray[3]);
x+=3; oldi += 9; ini += 9; oldx+=3; inx+=3;
}
}

Loading…
Cancel
Save