imtest routine

This commit is contained in:
Joseph Redmon 2015-06-10 14:44:10 -07:00
parent afe245329b
commit 9a63893f11
2 changed files with 11 additions and 22 deletions

View File

@ -106,7 +106,7 @@ void visualize(char *cfgfile, char *weightfile)
int main(int argc, char **argv)
{
//test_resize("data/cat.png");
//test_resize("data/bad.jpg");
//test_box();
//test_convolutional_layer();
if(argc < 2){
@ -142,6 +142,8 @@ int main(int argc, char **argv)
partial(argv[2], argv[3], argv[4], atoi(argv[5]));
} else if (0 == strcmp(argv[1], "visualize")){
visualize(argv[2], (argc > 3) ? argv[3] : 0);
} else if (0 == strcmp(argv[1], "imtest")){
test_resize(argv[2]);
} else {
fprintf(stderr, "Not an option: %s\n", argv[1]);
}

View File

@ -583,33 +583,20 @@ void test_resize(char *filename)
saturate_image(sat2, 2);
image sat5 = copy_image(im);
saturate_image(sat5, 5);
image sat10 = copy_image(im);
saturate_image(sat10, 10);
saturate_image(sat5, .5);
image exp2 = copy_image(im);
saturate_image(exp2, .5);
exposure_image(exp2, 2);
image exp5 = copy_image(im);
saturate_image(exp5, .5);
exposure_image(exp5, .5);
show_image(im, "original");
show_image(gray, "gray");
show_image(sat2, "sat2");
show_image(sat5, "sat5");
show_image(sat10, "sat10");
/*
show_image(small, "smaller");
show_image(big, "bigger");
show_image(crop, "crop");
show_image(crop2, "crop2");
show_image(rot, "rot");
show_image(rot2, "rot2");
show_image(test, "test");
*/
show_image(im, "Original");
show_image(gray, "Gray");
show_image(sat2, "Saturation-2");
show_image(sat5, "Saturation-.5");
show_image(exp2, "Exposure-2");
show_image(exp5, "Exposure-.5");
#ifdef OPENCV
cvWaitKey(0);
#endif
@ -666,7 +653,7 @@ image load_image_stb(char *filename, int channels)
int w, h, c;
unsigned char *data = stbi_load(filename, &w, &h, &c, channels);
if (!data) {
printf("Cannot load file image %s\n", filename);
fprintf(stderr, "Cannot load file image %s\nSTB Reason: %s\n", filename, stbi_failure_reason());
exit(0);
}
if(channels) c = channels;