Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
xmlyqing00 committed Jan 14, 2019
1 parent 8648f93 commit 129be0c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.vscode/

/data/saved_models/

/data/real_test/real1_31_bak/
/data/stripes/
/data/results/
/data/squares/
Expand Down
Binary file modified data/real_test/real1_31/26.XSM/00000001.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions include/stripes_solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class StripesSolver {
GCOM,
GREEDY_GCOM,
GT,
USER,
};

const string puzzle_folder;
Expand Down
32 changes: 24 additions & 8 deletions src/solver/stripes_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ bool StripesSolver::reassemble( Metric _metric_mode,
m_metric();

vector< vector<int> > fragments;
vector<int> sol_x;

switch (composition_mode) {
// 0
case Composition::GREEDY:
cout << "[INFO] Composition: Greedy." << endl;

Expand All @@ -116,18 +118,20 @@ bool StripesSolver::reassemble( Metric _metric_mode,

save_result(case_name, benchmark_flag);
break;


// 1
case Composition::GCOM:
cout << "[INFO] Composition: GCOM." << endl;

reassemble_GCOM();

composition_img = compose_img(composition_order);
composition_img_seams = add_seams(composition_img, composition_order);
composition_img = compose_img(composition_order, real_flag, &sol_x);
composition_img_seams = add_seams(composition_img, composition_order, true, &sol_x);

save_result(case_name, benchmark_flag);
break;

// 2
case Composition::GREEDY_GCOM:

// Greedy part
Expand All @@ -154,16 +158,27 @@ bool StripesSolver::reassemble( Metric _metric_mode,
composition_mode = Composition::GCOM;
reassemble_GCOM();

composition_img = compose_img(composition_order);
composition_img_seams = add_seams(composition_img, composition_order);
composition_img = compose_img(composition_order, real_flag, &sol_x);
composition_img_seams = add_seams(composition_img, composition_order, true, &sol_x);

save_result(case_name, benchmark_flag);
break;

// 3
case Composition::GT:

composition_img = compose_img(gt_order);
composition_img_seams = add_seams(composition_img, gt_order);
composition_img = compose_img(gt_order, real_flag, &sol_x);
composition_img_seams = add_seams(composition_img, gt_order, false, &sol_x);
save_result(case_name, false);
break;

// 4
case Composition::USER:
// composition_order = vector<int>({19,21,24,26,11,14,2,6,8,1,22,23,15,12,4,17,10,13,16,9,0,7,25,18,3,5});
composition_order = vector<int>({8,0,5,7,9,10,26,6,17,11,14,15,16,12,18,13,3,19,20,1,23,22,21,24,4,2,25});

composition_img = compose_img(composition_order, true, &sol_x);
composition_img_seams = add_seams(composition_img, composition_order, false, &sol_x);
save_result(case_name, false);
break;

Expand All @@ -182,6 +197,7 @@ cv::Mat StripesSolver::compose_img( const vector<int> & composition_order,
cv::Mat composition_img;
int x0, x1;
for (int i = 0; i < composition_order.size(); i++) {
cout << composition_order[i] << endl;
composition_img = merge_imgs(composition_img, stripes[composition_order[i]], shift_flag, &x0, &x1);
if (shift_flag) sol_x->push_back(x0);
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ cv::Mat merge_imgs( const cv::Mat & in_img0,
if (shift_flag) {
int shift_x0 = 0;
int shift_x1 = 0;
int block_h = in_img1.cols;
int detected_w = in_img1.cols * 0.6;
int block_h = in_img1.cols * 3;
int detected_w = in_img1.cols * 0.8;
int block_cnt = 0;
int out_width = 0;

Expand Down

0 comments on commit 129be0c

Please sign in to comment.