openMVG / openMVG

open Multiple View Geometry library. Basis for 3D computer vision and Structure from Motion.
Mozilla Public License 2.0
5.67k stars 1.67k forks source link

openMVG_main_ColHarmonize function crashes even for 3 input images #2084

Open mradul2 opened 2 years ago

mradul2 commented 2 years ago

Hey, I am facing a problem with openMVG_main_ColHarmonize function . I am running the following script:

path=$1
reference_img_id=$2

openMVG_main_SfMInit_ImageListing -i $path/images/ -o $path/matches -k "4375.318988319742;0.0;2736.0;0.0;4375.318988319742;1824.0;0.0;0.0;1.0"
openMVG_main_ComputeFeatures -i $path/matches/sfm_data.json -o $path/matches 
openMVG_main_ComputeMatches -i $path/matches/sfm_data.json -o $path/matches/matches.h.bin -p $path/matches/pair.txt
openMVG_main_ColHarmonize -i $path/matches/sfm_data.json -m $path/matches/matches.h.bin -o $path/output -s 1 -r $reference_img_id 

And the color harmonize function crashes:

openMVG_main_ColHarmonize: /home/ubuntu/mradul/mvg/openMVG/src/third_party/eigen/Eigen/src/Core/DenseStorage.h:147: Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 64>::plain_array() [with T = double; int Size = 256; int MatrixOrArrayOptions = 0]: Assertion `(internal::UIntPtr(eigen_unaligned_array_assert_workaround_gcc47(array)) & (63)) == 0 && "this assertion is explained here: " "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" " **** READ THIS WEB PAGE !!! ****"' failed.
run.sh: line 7: 10154 Aborted                 (core dumped) openMVG_main_ColHarmonize -i $path/matches/sfm_data.json -m $path/matches/matches.h.bin -o $path/output -s 1 -r $reference_img_id

Full log is this:

mradul:~/mradul/color-equalization/global_color_consistency/tech_park$ bash run.sh /home/ubuntu/mradul/color-equalization/global_color_consistency/tech_park/test2 1
INFO: [main_SfMInit_ImageListing.cpp:197]  You called : openMVG_main_SfMInit_ImageListing
--imageDirectory /home/ubuntu/mradul/color-equalization/global_color_consistency/tech_park/test2/images/
--sensorWidthDatabase 
--outputDirectory /home/ubuntu/mradul/color-equalization/global_color_consistency/tech_park/test2/matches
--focal -1
--intrinsics 4375.318988319742;0.0;2736.0;0.0;4375.318988319742;1824.0;0.0;0.0;1.0
--camera_model 3
--group_camera_model 1
--use_pose_prior 0
--prior_weights 1.0;1.0;1.0
--gps_to_xyz_method 0
INFO: [loggerprogress.hpp:79] [- Listing images -] 100%
INFO: [main_SfMInit_ImageListing.cpp:478] SfMInit_ImageListing report:
listed #File(s): 3
usable #File(s) listed in sfm_data: 3
usable #Intrinsic(s) listed in sfm_data: 1
INFO: [main_ComputeFeatures.cpp:121]  You called : 
openMVG_main_ComputeFeatures
--input_file /home/ubuntu/mradul/color-equalization/global_color_consistency/tech_park/test2/matches/sfm_data.json
--outdir /home/ubuntu/mradul/color-equalization/global_color_consistency/tech_park/test2/matches
--describerMethod AKAZE_FLOAT
--upright 0
--describerPreset NORMAL
--force 0
--numThreads 0

INFO: [loggerprogress.hpp:79] [- EXTRACT FEATURES -] 100%
INFO: [main_ComputeFeatures.cpp:344] Task done in (s): 0
INFO: [main_ComputeMatches.cpp:114]  You called : 
openMVG_main_ComputeMatches
--input_file /home/ubuntu/mradul/color-equalization/global_color_consistency/tech_park/test2/matches/sfm_data.json
--output_file /home/ubuntu/mradul/color-equalization/global_color_consistency/tech_park/test2/matches/matches.h.bin
--pair_list /home/ubuntu/mradul/color-equalization/global_color_consistency/tech_park/test2/matches/pair.txt
Optional parameters:
--force 0
--ratio 0.8
--nearest_matching_method ANNL2
--cache_size unlimited
--preemptive_feature_used/count 0 / 200
INFO: [loggerprogress.hpp:79] [- Regions Loading -] 100%
INFO: [main_ComputeMatches.cpp:217]  - PUTATIVE MATCHES - 
INFO: [main_ComputeMatches.cpp:226]      PREVIOUS RESULTS LOADED; #pair: 3
INFO: [main_ComputeMatches.cpp:366] #Putative pairs: 3
INFO: [graph_stats.hpp:53] Graph statistics:
        #nodes: 3
        #cc: 1
        #singleton: 0
        Node degree statistics: min: 2, max: 2, mean: 2, median: 2
Global Color Harmonization

INFO: [colorHarmonizeEngineGlobal.cpp:529] 
ColorHarmonizationEngineGlobal::CleanGraph() :: => connected Component cardinal: 1
INFO: [colorHarmonizeEngineGlobal.cpp:589] 
Cardinal of nodes: 3
Cardinal of edges: 3
INFO: [colorHarmonizeEngineGlobal.cpp:195] 
 Remaining cameras after CC filter : 
3 from a total of 3
INFO: [colorHarmonizeEngineGlobal.cpp:222] Current edge : EP-00-00012_0342_0033.JPG     EP-00-00012_0342_0034.JPG
INFO: [colorHarmonizeEngineGlobal.cpp:222] Current edge : EP-00-00012_0342_0033.JPG     EP-00-00012_0342_0035.JPG
INFO: [colorHarmonizeEngineGlobal.cpp:222] Current edge : EP-00-00012_0342_0034.JPG     EP-00-00012_0342_0035.JPG
INFO: [colorHarmonizeEngineGlobal.cpp:329] 
 -- 
 SOLVE for color consistency with linear programming
 --
INFO: [colorHarmonizeEngineGlobal.cpp:376] 
 ColorHarmonization solving on a graph with: 3 edges took (s): 0
LInfinity fitting error: 
- for the red channel is: 3.60135 gray level(s)
- for the green channel is: 3.7 gray level(s)
- for the blue channel is: 5.14727 gray level(s)
INFO: [colorHarmonizeEngineGlobal.cpp:384] 

Found solution_r:
0.986486 -6.18243 1 0 1.01363 1.72703 3.60135 INFO: [colorHarmonizeEngineGlobal.cpp:387] 

Found solution_g:
0.971429 -4.75714 1 0 1.00151 3.01792 3.7 INFO: [colorHarmonizeEngineGlobal.cpp:390] 

Found solution_b:
0.94859 -0.765734 1 0 0.958957 7.92708 5.14727 INFO: [colorHarmonizeEngineGlobal.cpp:393] 

There is :
3 images to transform.
openMVG_main_ColHarmonize: /home/ubuntu/mradul/mvg/openMVG/src/third_party/eigen/Eigen/src/Core/DenseStorage.h:147: Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 64>::plain_array() [with T = double; int Size = 256; int MatrixOrArrayOptions = 0]: Assertion `(internal::UIntPtr(eigen_unaligned_array_assert_workaround_gcc47(array)) & (63)) == 0 && "this assertion is explained here: " "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" " **** READ THIS WEB PAGE !!! ****"' failed.
run.sh: line 7:  4602 Aborted                 (core dumped) openMVG_main_ColHarmonize -i $path/matches/sfm_data.json -m $path/matches/matches.h.bin -o $path/output -s 1 -r $reference_img_id

There is just three input colored images with the following pair.txt:

0 1
1 2
2 0

The cleaned graph created is:

graph 1 {
node [shape=circle]
 n1 --  n2
 n0 --  n2
 n0 --  n1
}

For some of the image cases it worked, but for most of the images, it is crashing.

pmoulon commented 2 years ago

The reported error is an alignment error from EIgen, I don't know why it appears only for some data and not some others. BTW, it seems that the solving steps is working, it is the steps that correct the images that seems to fails in your case