json87 / SphereSfM

SfM for sphere images in the ERP format within the framework of ColMap
BSD 3-Clause "New" or "Revised" License
106 stars 15 forks source link

Issue With Model Merger in SphereSFM #19

Closed paidiakileswar closed 3 weeks ago

paidiakileswar commented 3 months ago

Hai @json87 @satyajitghana

I was trying to merge my 2 models

Method - 1:

So Firstly i divided my images

SPLIT 1 => 1- 400 SPLIT 2 => 300 - 700

Here i got 2 sparses as output from both SPLIT 1 and SPLIT 2 , Both of them i reconstucted in differently , (like in 2 servers )

So i have now scaled outputs of SPLIT 1 & SPLIT 2 which i have got after applying mapper & model aligner

Now I have 2 sparses i converted them into .txt files

So i have sparse_1 -> cameras.txt,images.txt,points3D.txt

sparse_2 -> cameras.txt,images.txt,points3D.txt

I have modified the image_id in both images.txt & points3D.txt , such that they are unique as per https://github.com/colmap/colmap/issues/1703#issuecomment-1331828759

Screenshot 2024-06-25 142533

I am getting this issue , Please help me here

Method - 2:

Here i have 438 images

I divided as 1 - 250 200 - 438

So i done Feature Extraction , Matching ,

Mapper here i changed the using --image_list_path names_1.txt --image_list_path names_2.txt

I got 2 sparses

While merging colmap model_merger --input_path1 ./sparse/0/ --input_path2 ./sparse_1/0/ --output_path ./merger/

I got this issue

image

Stack Backtrace

image

Could you help me here , I am stuck here Best Regards Akil

satyajitghana commented 3 months ago

Hi,

how can I reproduce your output?

can you share some example datasets? and the commands you used? you can share me a google drive link.

paidiakileswar commented 3 months ago

Here is the sample data i used @satyajitghana

Drive Link - ..

My folder structure

-images
------------VID_....JPG
------------VID_....JPG
------------VID_....JPG

-POS.txt

-colmap
-------------database.db
-------------sparse
-------------sparse_1

Commands:

1) colmap database_creator --database_path ./colmap/database.db

2) time colmap feature_extractor --database_path ./colmap/database.db --image_path ./images --ImageReader.camera_model SPHERE --ImageReader.camera_params "1,2048,1024" --ImageReader.single_camera 1 --ImageReader.pose_path ./POS.txt

3) time colmap spatial_matcher --database_path ./colmap/database.db --SiftMatching.max_error 4 --SiftMatching.min_num_inliers 50 --SpatialMatching.is_gps 0 --SpatialMatching.max_distance 50

4) time colmap mapper --database_path ./colmap/database.db --image_path ./images --output_path ./colmap/sparse --Mapper.ba_refine_focal_length 0 --Mapper.ba_refine_principal_point 0 --Mapper.ba_refine_extra_params 0 --Mapper.sphere_camera 1 --image_list_path names_1.txt

5) time colmap mapper --database_path ./colmap/database.db --image_path ./images --output_path ./colmap/sparse_1 --Mapper.ba_refine_focal_length 0 --Mapper.ba_refine_principal_point 0 --Mapper.ba_refine_extra_params 0 --Mapper.sphere_camera 1 --image_list_path names_2.txt

I got two sparses as output 1 in sparse/0 2 in sparse_1/0

Then i created mkdir merger and ran the command

colmap model_merger --input_path1 ./colmap/sparse/0/ --input_path2 ./colmap/sparse_1/0/ --output_path ./merger/

Hope this data is sufficient , Please help me with this @satyajitghana

satyajitghana commented 3 months ago

@paidiakileswar how was the POS.txt generated?

paidiakileswar commented 3 months ago

@satyajitghana

POS.txt contains

F=N X Y Z R

Name and x,y,z utm coordinates and R array i considered as identity matrix

[1 0 0 0 1 0 0 0 1]

I have name x,y,z from camera geo positions then i added identity matrix at the end to every row thats it!

In this way i generated POS.txt , it worked fine on all the datasets !

satyajitghana commented 3 months ago

ok, let me try it out tomorrow

paidiakileswar commented 3 months ago

Thanks very much @satyajitghana

My aim is to get good sparse here and use it further densification , if any suggestions or methods other than this - you can suggest me that will be helpful to my research so much !!

Best Regards Paidi Akileswar

satyajitghana commented 3 months ago
F20240628 12:26:56.631281 3829852 mat.h:167] Check failed: width_ > 0 (0 vs. 0) 
*** Check failure stack trace: ***
    @     0x7f5e2c31403e  google::LogMessage::Fail()
    @     0x7f5e2c313f80  google::LogMessage::SendToLog()
    @     0x7f5e2c31379e  google::LogMessage::Flush()
    @     0x7f5e2c317442  google::LogMessageFatal::~LogMessageFatal()
    @     0x5638fe25df63  colmap::mvs::Mat<>::Read()
    @     0x5638fe25c3c9  colmap::mvs::CachedWorkspace::GetDepthMap()
    @     0x5638fe4f705d  colmap::mvs::PatchMatchController::ProcessProblem()
    @     0x5638fe4fac3d  _ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_12_Task_setterIS0_INS1_7_ResultIvEES3_EZNS1_11_Task_stateISt5_BindIFMN6colmap3mvs20PatchMatchControllerEFvRKNSD_17PatchMatchOptionsEmEPSE_SF_mEESaIiEFvvEE6_M_runEvEUlvE_vEEE9_M_invokeERKSt9_Any_data
    @     0x5638fe081f8d  std::__future_base::_State_baseV2::_M_do_set()
    @     0x7f5e0140a4df  __pthread_once_slow
    @     0x5638fe4fb491  _ZNSt17_Function_handlerIFvvEZN6colmap10ThreadPool7AddTaskIMNS1_3mvs20PatchMatchControllerEFvRKNS4_17PatchMatchOptionsEmEJPS5_S8_RmEEESt6futureINSt9result_ofIFT_DpT0_EE4typeEEOSF_DpOSG_EUlvE_E9_M_invokeERKSt9_Any_data
    @     0x5638fe35c634  colmap::ThreadPool::WorkerFunc()
    @     0x7f5e00fcd793  (unknown)
    @     0x7f5e01401609  start_thread
    @     0x7f5e00c4d353  clone
    @              (nil)  (unknown)
[1]    3803722 abort (core dumped)  colmap GUI
paidiakileswar commented 3 months ago

@satyajitghana

As My aim is to get best sparse -> I was running till the SFM stage only

Like Till -> colmap mapper

I am not much aware of why this error occured in the MVS stage

paidiakileswar commented 3 months ago

@satyajitghana Any info about about your try ??

Any output - Regarding merging of multiple sparse reconstructions

Like 0,1,2 -> Single merged sparse 0

Regards Akileswar

json87 commented 2 months ago

Hi, all. This repo only implements SfM for spherical images.

paidiakileswar commented 2 months ago

Hai @json87 @satyajitghana

I was trying to merge my 2 models

Method - 1:

So Firstly i divided my images

SPLIT 1 => 1- 400 SPLIT 2 => 300 - 700

Here i got 2 sparses as output from both SPLIT 1 and SPLIT 2 , Both of them i reconstucted in differently , (like in 2 servers )

So i have now scaled outputs of SPLIT 1 & SPLIT 2 which i have got after applying mapper & model aligner

Now I have 2 sparses i converted them into .txt files

So i have sparse_1 -> cameras.txt,images.txt,points3D.txt

sparse_2 -> cameras.txt,images.txt,points3D.txt

I have modified the image_id in both images.txt & points3D.txt , such that they are unique as per colmap/colmap#1703 (comment)

Screenshot 2024-06-25 142533

I am getting this issue , Please help me here

Method - 2:

Here i have 438 images

I divided as 1 - 250 200 - 438

So i done Feature Extraction , Matching ,

Mapper here i changed the using --image_list_path names_1.txt --image_list_path names_2.txt

I got 2 sparses

While merging colmap model_merger --input_path1 ./sparse/0/ --input_path2 ./sparse_1/0/ --output_path ./merger/

I got this issue

image

Stack Backtrace

image

Could you help me here , I am stuck here Best Regards Akil

Can you help with this !! This is my main issue > @json87

json87 commented 2 months ago

I have not test model merge for spherical images, If possible, you can share these two models for test.