mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
width and stuff
This commit is contained in:
parent
48401dcbf1
commit
3b864c2254
4
Makefile
4
Makefile
@ -42,7 +42,7 @@ endif
|
||||
OBJS = $(addprefix $(OBJDIR), $(OBJ))
|
||||
DEPS = $(wildcard src/*.h) Makefile
|
||||
|
||||
all: obj $(EXEC)
|
||||
all: obj results $(EXEC)
|
||||
|
||||
$(EXEC): $(OBJS)
|
||||
$(CC) $(COMMON) $(CFLAGS) $(LDFLAGS) $^ -o $@
|
||||
@ -55,6 +55,8 @@ $(OBJDIR)%.o: %.cu $(DEPS)
|
||||
|
||||
obj:
|
||||
mkdir -p obj
|
||||
results:
|
||||
mkdir -p results
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
|
@ -20,6 +20,7 @@ void draw_detection(image im, float *box, int side, char *label)
|
||||
j = (r*side + c) * elems;
|
||||
int class = max_index(box+j, classes);
|
||||
if(box[j+class] > 0.2){
|
||||
int width = box[j+class]*5 + 1;
|
||||
printf("%f %s\n", box[j+class], class_names[class]);
|
||||
float red = get_color(0,class,classes);
|
||||
float green = get_color(1,class,classes);
|
||||
@ -39,9 +40,7 @@ void draw_detection(image im, float *box, int side, char *label)
|
||||
int right = (x+w/2)*im.w;
|
||||
int top = (y-h/2)*im.h;
|
||||
int bot = (y+h/2)*im.h;
|
||||
draw_box(im, left, top, right, bot, red, green, blue);
|
||||
draw_box(im, left+1, top+1, right+1, bot+1, red, green, blue);
|
||||
draw_box(im, left-1, top-1, right-1, bot-1, red, green, blue);
|
||||
draw_box_width(im, left, top, right, bot, width, red, green, blue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,14 @@ 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)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < w; ++i){
|
||||
draw_box(a, x1+i, y1+i, x2-i, y2-i, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
void flip_image(image a)
|
||||
{
|
||||
int i,j,k;
|
||||
|
@ -23,6 +23,7 @@ typedef struct {
|
||||
float get_color(int c, int x, int max);
|
||||
void flip_image(image a);
|
||||
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);
|
||||
image image_distance(image a, image b);
|
||||
void scale_image(image m, float s);
|
||||
image crop_image(image im, int dx, int dy, int w, int h);
|
||||
|
Loading…
Reference in New Issue
Block a user