summaryrefslogtreecommitdiff
path: root/main.cc
blob: eab058bea55bcff56c18ddbf771315ab5069f56f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <cstdio>
#include <omp.h>
#include "cv.h"
#include "highgui.h"

#include "compute.h"
#include "stitch.h"
#include "explore.h"
#include "utils.h"

int main(int argc, char** argv)
{
  if (argc < 3)
  {
    fprintf(stderr, "Usage : %s VIDEO DIRECTION\n", argv[0]);
    return -2;
  }

  int direction = atoi(argv[2]);
  if (direction != 1 && direction != -1)
  {
    fprintf(stderr, "DIRECTION must be 1 or -1\n");    
    return -2;
  }
  fprintf(stderr, "Video direction %d\n", direction);

  VideoCapture cap(argv[1]);
  if(!cap.isOpened())
    return -1;

  int frames_count = cap.get(CV_CAP_PROP_FRAME_COUNT);
  int width = cap.get(CV_CAP_PROP_FRAME_WIDTH);
  int height = cap.get(CV_CAP_PROP_FRAME_HEIGHT);
  vector<Mat> frames (frames_count);
  for(int i = 0; i < frames_count; ++i)
  {
    Mat frame, frame_double;
    cap >> frame;
    frames[i] = rgb_to_cspace4c(frame).clone();
  }

  vector<vector<Mat> > downscaled;
  vector<Mat> mosaics;
  vector<Path> paths;

  Mat mosaic = compute_mosaic(frames, direction, downscaled, mosaics, paths);
  return 0;
}