diff --git a/app/src/main/cpp/hdrplus/src/align.cpp b/app/src/main/cpp/hdrplus/src/align.cpp index 98f6eb88..cc2d9219 100644 --- a/app/src/main/cpp/hdrplus/src/align.cpp +++ b/app/src/main/cpp/hdrplus/src/align.cpp @@ -933,6 +933,8 @@ void align::process( const hdrplus::burst& burst_images, \ // Align every image const std::vector& ref_grayimg_pyramid = per_grayimg_pyramid[ burst_images.reference_image_idx ]; + std::vector>> curr_alignment; + std::vector>> prev_alignment; for ( int img_idx = 0; img_idx < burst_images.num_images; ++img_idx ) { // Do not align with reference image @@ -944,8 +946,8 @@ void align::process( const hdrplus::burst& burst_images, \ // Align every level from coarse to grain // level 0 : finest level, the original image // level 3 : coarsest level - std::vector>> curr_alignment; - std::vector>> prev_alignment; + curr_alignment.clear(); + prev_alignment.clear(); for ( int level_i = num_levels - 1; level_i >= 0; level_i-- ) // 3,2,1,0 { // make curr alignment as previous alignment diff --git a/app/src/main/cpp/hdrplus/src/hdrplus_pipeline.cpp b/app/src/main/cpp/hdrplus/src/hdrplus_pipeline.cpp index 3cf00719..2ba525c7 100644 --- a/app/src/main/cpp/hdrplus/src/hdrplus_pipeline.cpp +++ b/app/src/main/cpp/hdrplus/src/hdrplus_pipeline.cpp @@ -10,6 +10,10 @@ #include "hdrplus/finish.h" #include +#ifdef __ANDROID__ +#include +#endif + namespace hdrplus { @@ -19,6 +23,7 @@ void hdrplus_pipeline::run_pipeline( \ { // Create burst of images burst burst_images( burst_path, reference_image_path ); + std::vector>>> alignments; // Run align @@ -27,6 +32,7 @@ void hdrplus_pipeline::run_pipeline( \ // Run merging merge_module.process( burst_images, alignments ); + // Run finishing cv::Mat finalImg; finish_module.process( burst_images, finalImg); @@ -39,15 +45,27 @@ bool hdrplus_pipeline::run_pipeline( \ // Create burst of images burst burst_images( burst_paths, reference_image_index ); std::vector>>> alignments; +#ifdef __ANDROID__ + ALOGI("Finish loading images"); +#endif // Run align align_module.process( burst_images, alignments ); +#ifdef __ANDROID__ + ALOGI("Finish align"); +#endif // Run merging merge_module.process( burst_images, alignments ); +#ifdef __ANDROID__ + ALOGI("Finish merging"); +#endif // Run finishing finish_module.process( burst_images, finalImg); +#ifdef __ANDROID__ + ALOGI("Finish process"); +#endif return true; } diff --git a/app/src/main/cpp/hdrplus/src/merge.cpp b/app/src/main/cpp/hdrplus/src/merge.cpp index 5e0de3b5..bdf5c400 100644 --- a/app/src/main/cpp/hdrplus/src/merge.cpp +++ b/app/src/main/cpp/hdrplus/src/merge.cpp @@ -116,8 +116,9 @@ namespace hdrplus // 1. get all four subsets: original (evenly split), horizontal overlapped, // vertical overlapped, 2D overlapped std::vector> tiles_original; + std::vector row; for (int y = 0; y < num_rows / offset - 1; y += 2) { - std::vector row; + row.clear(); for (int x = 0; x < num_cols / offset - 1; x += 2) { row.push_back(tiles[y * (num_cols / offset - 1) + x]); } @@ -125,8 +126,9 @@ namespace hdrplus } std::vector> tiles_horizontal; + // std::vector row; for (int y = 0; y < num_rows / offset - 1; y += 2) { - std::vector row; + row.clear(); for (int x = 1; x < num_cols / offset - 1; x += 2) { row.push_back(tiles[y * (num_cols / offset - 1) + x]); } @@ -134,8 +136,9 @@ namespace hdrplus } std::vector> tiles_vertical; + // std::vector row; for (int y = 1; y < num_rows / offset - 1; y += 2) { - std::vector row; + row.clear(); for (int x = 0; x < num_cols / offset - 1; x += 2) { row.push_back(tiles[y * (num_cols / offset - 1) + x]); } @@ -143,8 +146,9 @@ namespace hdrplus } std::vector> tiles_2d; + // std::vector row; for (int y = 1; y < num_rows / offset - 1; y += 2) { - std::vector row; + row.clear(); for (int x = 1; x < num_cols / offset - 1; x += 2) { row.push_back(tiles[y * (num_cols / offset - 1) + x]); } @@ -190,9 +194,10 @@ namespace hdrplus std::vector> alt_tiles_list(reference_tiles.size()); int num_tiles_row = alternate_channel_i_list[0].rows / offset - 1; int num_tiles_col = alternate_channel_i_list[0].cols / offset - 1; + std::vector alt_tiles; for (int y = 0; y < num_tiles_row; ++y) { for (int x = 0; x < num_tiles_col; ++x) { - std::vector alt_tiles; + alt_tiles.clear(); // Get reference tile location int top_left_y = y * offset; int top_left_x = x * offset;