mirror of https://github.com/AlexeyAB/darknet.git
Minor fix
This commit is contained in:
parent
03eee3092f
commit
4098e4882c
22
src/image.c
22
src/image.c
|
@ -155,6 +155,25 @@ void draw_label(image a, int r, int c, image label, const float *rgb)
|
|||
}
|
||||
}
|
||||
|
||||
void draw_weighted_label(image a, int r, int c, image label, const float *rgb, const float alpha)
|
||||
{
|
||||
int w = label.w;
|
||||
int h = label.h;
|
||||
if (r - h >= 0) r = r - h;
|
||||
|
||||
int i, j, k;
|
||||
for (j = 0; j < h && j + r < a.h; ++j) {
|
||||
for (i = 0; i < w && i + c < a.w; ++i) {
|
||||
for (k = 0; k < label.c; ++k) {
|
||||
float val1 = get_pixel(label, i, j, k);
|
||||
float val2 = get_pixel(a, i + c, j + r, k);
|
||||
float val_dst = val1 * rgb[k] * alpha + val2 * (1 - alpha);
|
||||
set_pixel(a, i + c, j + r, k, val_dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void draw_box_bw(image a, int x1, int y1, int x2, int y2, float brightness)
|
||||
{
|
||||
//normalize_image(a);
|
||||
|
@ -423,7 +442,8 @@ void draw_detections_v3(image im, detection *dets, int num, float thresh, char *
|
|||
}
|
||||
}
|
||||
image label = get_label_v3(alphabet, labelstr, (im.h*.02));
|
||||
draw_label(im, top + width, left, label, rgb);
|
||||
//draw_label(im, top + width, left, label, rgb);
|
||||
draw_weighted_label(im, top + width, left, label, rgb, 0.7);
|
||||
free_image(label);
|
||||
}
|
||||
if (selected_detections[i].det.mask) {
|
||||
|
|
|
@ -28,6 +28,7 @@ void draw_box(image a, int x1, int y1, int x2, int y2, float r, float g, float b
|
|||
void draw_box_width(image a, int x1, int y1, int x2, int y2, int w, float r, float g, float b);
|
||||
void draw_bbox(image a, box bbox, int w, float r, float g, float b);
|
||||
void draw_label(image a, int r, int c, image label, const float *rgb);
|
||||
void draw_weighted_label(image a, int r, int c, image label, const float *rgb, const float alpha);
|
||||
void write_label(image a, int r, int c, image *characters, char *string, float *rgb);
|
||||
void draw_detections(image im, int num, float thresh, box *boxes, float **probs, char **names, image **labels, int classes);
|
||||
void draw_detections_v3(image im, detection *dets, int num, float thresh, char **names, image **alphabet, int classes, int ext_output);
|
||||
|
|
Loading…
Reference in New Issue