struct image_t* detect_window(struct image_t *img) { uint16_t coordinate[2]; coordinate[0] = 0; coordinate[1] = 0; uint16_t response = 0; uint32_t integral_image[img->w * img->h]; struct image_t gray; image_create(&gray, img->w, img->h, IMAGE_GRAYSCALE); image_to_grayscale(img, &gray); response = detect_window_sizes((uint8_t *)gray.buf, (uint32_t)img->w, (uint32_t)img->h, coordinate, integral_image, MODE_BRIGHT); printf("Coordinate: %d, %d\n", coordinate[0], coordinate[1]); printf("Response = %d\n", response); image_free(&gray); return NULL; // No new image was created }
bool_t cv_window_func(struct image_t *img) { if (!window_enabled) return FALSE; uint16_t coordinate[2] = {0,0}; uint16_t response = 0; uint32_t integral_image[img->w * img->h]; struct image_t gray; image_create(&gray, img->w, img->h, IMAGE_GRAYSCALE); image_to_grayscale(img, &gray); response = detect_window_sizes( (uint8_t*)gray.buf, (uint32_t)img->w, (uint32_t)img->h, coordinate, integral_image, MODE_BRIGHT); image_free(&gray); // Display the marker location and center-lines. int px = coordinate[0] & 0xFFFe; int py = coordinate[1] & 0xFFFe; if (response < 92) { for (int y = 0; y < img->h-1; y++) { Img(px, y) = 65; Img(px+1, y) = 255; } for (int x = 0; x < img->w-1; x+=2) { Img(x, py) = 65; Img(x+1, py) = 255; } uint32_t temp = coordinate[0]; temp = temp << 16; temp += coordinate[1]; blob_locator = temp; } return FALSE; }