25 #include <fvfilters/morphology/segenerator.h>
26 #include <fvutils/color/colorspaces.h>
27 #include <fvutils/draw/drawer.h>
28 #include <fvutils/writers/fvraw.h>
29 #include <fvutils/writers/png.h>
30 #include <utils/math/angle.h>
35 namespace firevision {
56 unsigned int *proposed_center_x,
57 unsigned int *proposed_center_y,
58 float slope_angle_rad)
72 (
unsigned char *)malloc(colorspace_buffer_size(YUV422_PLANAR, width, height));
73 memset(tmp, 0, colorspace_buffer_size(YUV422_PLANAR, width, height));
80 if ((a == M_PI / 2) || (a == -M_PI / 2)) {
91 int y = (int)roundf(((
float)width - 1.f) * tan(a));
104 unsigned char *se = (
unsigned char *)malloc((
size_t)width * (size_t)height);
105 memcpy(se, tmp, (
size_t)width * (
size_t)height);
120 if ((proposed_center_x != NULL) && (proposed_center_y != NULL)) {
121 unsigned int min_x = width;
122 unsigned int max_x = 0;
123 unsigned int min_y = height;
124 unsigned int max_y = 0;
125 for (
unsigned int h = 0; h < height; ++h) {
126 for (
unsigned int w = 0; w < width; ++w) {
127 if (se[h * width + w] != 0) {
140 *proposed_center_x = min_x + (max_x - min_x) / 2;
141 *proposed_center_y = min_y + (max_y - min_y) / 2;
156 unsigned char *se = (
unsigned char *)malloc((
size_t)width * (size_t)height);
157 memset(se, 1, (
size_t)width * (
size_t)height);
174 memset(yuv422planar_buffer, 128, colorspace_buffer_size(YUV422_PLANAR, width, height));
175 for (
unsigned int h = 0; h < height; ++h) {
176 for (
unsigned int w = 0; w < width; ++w) {
177 if (mask[h * width + w] != 0) {
178 yuv422planar_buffer[h * width + w] = 255;
197 memset(yuv422planar_buffer, 128, colorspace_buffer_size(YUV422_PLANAR, width, height));
198 memset(yuv422planar_buffer, 255, (
size_t)width * (
size_t)height);
199 for (
unsigned int h = 0; h < height; ++h) {
200 for (
unsigned int w = 0; w < width; ++w) {
201 if (mask[h * width + w] != 0) {
202 yuv422planar_buffer[h * width + w] = 0;