#include "yuv.h"
#include "mark.h"
#include "process.h"
+#include "settings.h"
#include "dir_seperator.h"
#ifdef WITH_OPENCV
#include "opticalflow.h"
* options
*/
-static int in_itr_num = 5, out_itr_num = 1, optical_flow = 1, bright_contrast = 1, alpha_change = 1;
+static int in_itr_num = 5, out_itr_num = 1, quick = 0, optical_flow = 1, bright_contrast = 1, alpha_change = 1;
int scale = 1, scalexyz = 999;
+static char output_prefix[256] = "";
static enum test test = NO_TEST;
static struct option long_options[] = {
{"help", 0, 0, 'h'},
{"depth", 1, 0, 'd'},
+ {"output-prefix", 1, 0, 'O'},
{"in-itr-num", 1, 0, 'i'},
{"out-itr-num", 1, 0, 'o'},
+ {"quick", 0, 0, 'q'},
{"zscale", 1, 0, 'z'},
{"brightness-contrast", 1, 0, 'b'},
{"optical-flow", 1, 0, 'f'},
{0, 0, 0, 0},
};
- c = getopt_long(argc, argv, "hd:i:o:z:b:f:s:t:", long_options, &option_index);
+ c = getopt_long(argc, argv, "hd:O:i:o:qz:b:f:s:t:", long_options, &option_index);
if (c == -1)
break;
save_depth = atoi(optarg);
skip_args += 2;
break;
+ case 'O':
+ strcpy(output_prefix, optarg);
+ skip_args += 2;
+ break;
case 'i':
in_itr_num = atoi(optarg);
skip_args += 2;
out_itr_num = atoi(optarg);
skip_args += 2;
break;
+ case 'q':
+ quick = 1;
+ skip_args += 1;
+ break;
case 'z':
scalexyz = atoi(optarg);
skip_args += 2;
printf("\nOptions:\n");
printf(" -h --help This help\n");
printf(" -d --depth <bits> Save images with given color bit depth (default=%d)\n", save_depth);
+ printf(" -O --output-prefix <path>/<prefix> Store result image of a sequence using this prefix\n");
printf(" -i --in-itr-num <num> Alter inner iterations (weightening count) of colorization algorithm (default=%d)\n", in_itr_num);
printf(" -o --out-itr-num <num> Alter outer iterations (complete turns) of colorization algorithm (default=%d)\n", out_itr_num);
+ printf(" -q --quick Use quick render, but sufaces may be colorized incomplete\n");
printf(" -z --zscale <levels> How many grids (staring with the finest) should be scaled in z direction to generate the next coarse grid ");
if (scalexyz < 999)
printf("(default=%d)\n", scalexyz);
}
#ifdef WITH_OPENCV
// load flow settings
- if (sequence && optical_flow) {
+ if (sequence && optical_flow)
flow_default();
- load_flow(first_filename);
+#endif
+ load_settings(first_filename);
+#ifdef WITH_OPENCV
+ // load flow settings
+ if (sequence && optical_flow) {
if (flow_enable == 0 && (test == FLOW_NEXT || test == FLOW_PREV)) {
fprintf(stderr, "Cannot test optical flow, because it is not enabled by GUI.\n");
exit (0);
if (test != FLOW_NEXT && test != FLOW_PREV && test != MARKED && test != MASK && test != MASK_COLOR && test != BC_ONLY && test != BC_IMAGE) {
printf("Colorizing %d frames, please wait...\n", k);
- rc = colorize(I, mI, flow, flow_i, in_itr_num, out_itr_num, scalexyz, feat_names);
+ rc = colorize(I, mI, flow, flow_i, in_itr_num, out_itr_num, quick, scalexyz, feat_names, NULL);
if (rc < 0) {
if (k > 1)
printf("No memory! Use smaller frames or less frames between key frames or add more memory.");
p = sequence[z].filename;
while((q = strchr(p, DIR_SEPERATOR)))
p = q + 1;
- strcpy(name, sequence[z].filename);
- name[p - sequence[z].filename] = '\0';
- strcat(name, "colorized_");
+ if (output_prefix[0] == '\0') {
+ strcpy(name, sequence[z].filename);
+ name[p - sequence[z].filename] = '\0';
+ strcat(name, "colorized_");
+ } else {
+ strcpy(name, output_prefix);
+ }
strcat(name, p);
filename = name;
} else