| | |
| | | float prob = probs[i][class]; |
| | | if(prob > thresh){ |
| | | int width = pow(prob, 1./2.)*10+1; |
| | | width = 8; |
| | | printf("%s: %.2f\n", names[class], prob); |
| | | int offset = class*17 % classes; |
| | | float red = get_color(0,offset,classes); |
| | |
| | | w = (w * min) / h; |
| | | h = min; |
| | | } |
| | | if(w == im.w && h == im.h) return im; |
| | | image resized = resize_image(im, w, h); |
| | | return resized; |
| | | } |
| | |
| | | int dy = rand_int(0, resized.h - size); |
| | | image crop = crop_image(resized, dx, dy, size, size); |
| | | |
| | | /* |
| | | show_image(im, "orig"); |
| | | show_image(crop, "cropped"); |
| | | cvWaitKey(0); |
| | | */ |
| | | |
| | | free_image(resized); |
| | | if(resized.data != im.data) free_image(resized); |
| | | return crop; |
| | | } |
| | | |