| | |
| | | |
| | | if( (src = cvLoadImage(filename, flag)) == 0 ) |
| | | { |
| | | fprintf(stderr, "Cannot load image \"%s\"\n", filename); |
| | | char buff[256]; |
| | | sprintf(buff, "echo %s >> bad.list", filename); |
| | | system(buff); |
| | | char shrinked_filename[1024]; |
| | | if (strlen(filename) >= 1024) sprintf(shrinked_filename, "name is too long"); |
| | | else sprintf(shrinked_filename, "%s", filename); |
| | | fprintf(stderr, "Cannot load image \"%s\"\n", shrinked_filename); |
| | | FILE* fw = fopen("bad.list", "a"); |
| | | fwrite(shrinked_filename, sizeof(char), strlen(shrinked_filename), fw); |
| | | char *new_line = "\n"; |
| | | fwrite(new_line, sizeof(char), strlen(new_line), fw); |
| | | fclose(fw); |
| | | return make_image(10,10,3); |
| | | //exit(EXIT_FAILURE); |
| | | } |
| | |
| | | return im; |
| | | } |
| | | |
| | | int get_stream_fps(CvCapture *cap, int cpp_video_capture) |
| | | { |
| | | int fps = 25; |
| | | if (cpp_video_capture) { |
| | | fps = get_stream_fps_cpp(cap); |
| | | } |
| | | else { |
| | | fps = cvGetCaptureProperty(cap, CV_CAP_PROP_FPS); |
| | | } |
| | | return fps; |
| | | } |
| | | |
| | | void save_image_jpg(image p, const char *name) |
| | | { |
| | | image copy = copy_image(p); |
| | |
| | | int w, h, c; |
| | | unsigned char *data = stbi_load(filename, &w, &h, &c, channels); |
| | | if (!data) { |
| | | fprintf(stderr, "Cannot load image \"%s\"\nSTB Reason: %s\n", filename, stbi_failure_reason()); |
| | | char buff[256]; |
| | | sprintf(buff, "echo %s >> bad.list", filename); |
| | | system(buff); |
| | | char shrinked_filename[1024]; |
| | | if (strlen(filename) >= 1024) sprintf(shrinked_filename, "name is too long"); |
| | | else sprintf(shrinked_filename, "%s", filename); |
| | | fprintf(stderr, "Cannot load image \"%s\"\nSTB Reason: %s\n", shrinked_filename, stbi_failure_reason()); |
| | | FILE* fw = fopen("bad.list", "a"); |
| | | fwrite(shrinked_filename, sizeof(char), strlen(shrinked_filename), fw); |
| | | char *new_line = "\n"; |
| | | fwrite(new_line, sizeof(char), strlen(new_line), fw); |
| | | fclose(fw); |
| | | return make_image(10, 10, 3); |
| | | //exit(EXIT_FAILURE); |
| | | } |