Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about the image undistortion #94

Open
ewrfcas opened this issue Sep 6, 2022 · 8 comments
Open

Question about the image undistortion #94

ewrfcas opened this issue Sep 6, 2022 · 8 comments

Comments

@ewrfcas
Copy link

ewrfcas commented Sep 6, 2022

Thanks for your great work!

I am using your undistort_reconstructions.py to undistort megadepth images, but some problems have happened.
There are 195 scenes in megadepth at all, but only 163 scenes are undistorted successfully.
And for those failed cases, they fail to be checked with the image sizes as follows (happened in scene 0001):

Undistorting image [2476/3409]
Undistorting image [2477/3409]
F0906 10:57:19.824895 51649 undistortion.cc:941] Check failed: distorted_camera.Width() == distorted_bitmap.Width() (1280 v
s. 960)
*** Check failure stack trace: ***
    @     0x7f1324b745cd  google::LogMessage::Fail()
    @     0x7f1324b76433  google::LogMessage::SendToLog()
    @     0x7f1324b7415b  google::LogMessage::Flush()
    @     0x7f1324b76e1e  google::LogMessageFatal::~LogMessageFatal()
    @           0x6cc243  colmap::UndistortImage()
    @           0x6cc601  colmap::COLMAPUndistorter::Undistort()
    @           0x6d2974  std::_Function_handler<>::_M_invoke()
Undistorting image [2478/3409]
Undistorting image [2479/3409]
Undistorting image [2480/3409]
    @           0x601b29  std::__future_base::_State_baseV2::_M_do_set()
    @     0x7f13207daa99  __pthread_once_slow
    @           0x6d35ec  std::__future_base::_Task_state<>::_M_run()
    @           0x8655dc  colmap::ThreadPool::WorkerFunc()
    @     0x7f13200acd4e  (unknown)
    @     0x7f13207d36ba  start_thread
    @     0x7f131f7f851d  clone
    @              (nil)  (unknown)
@leon5678
Copy link

hi, i tried to download the MegaDepth_SfM_v1.tar.xz, but failed.
could you tell me that how did you download the dataset successfully?

@cailile
Copy link

cailile commented Jun 2, 2024

I encountered the same problem. I check the camera width in cameras.txt and the image dimension of the corresponding image, and I found that they are actually the same. It is weird that after reading into memory, the dimensions became mismatched. Have you figured out how to get around with it?

@mihaidusmanu
Copy link
Owner

Hello. I remember that some scenes used the default COLMAP parameters (notably the image_undistorter --max_image_size), while some others used some custom values. This is why in the script I try to decide on the right resolution based on the output depthmaps / images provided by MegaDepth. Could it be that there is an issue in the propagation of these params (I have not used these scripts for quite a while now)?

Alternatively, you can directly download the undistorted data from https://cvg-data.inf.ethz.ch/megadepth/

@mihaidusmanu
Copy link
Owner

Another reason why the image sizes might be mismatched is due to EXIF information (notably image rotation) > maybe at some point they were ignored but now they are taken into account.

@cailile
Copy link

cailile commented Jun 2, 2024

Hello. I remember that some scenes used the default COLMAP parameters (notably the image_undistorter --max_image_size), while some others used some custom values. This is why in the script I try to decide on the right resolution based on the output depthmaps / images provided by MegaDepth. Could it be that there is an issue in the propagation of these params (I have not used these scripts for quite a while now)?

Alternatively, you can directly download the undistorted data from https://cvg-data.inf.ethz.ch/megadepth/

Thanks a lot for the prompt reply and the download link. I look into the source code in colmap/src/colmap/image/undistortion.cc, and found that the error occur in the first line of the function UndistortImage() -- basically the program just done some I/O, not started the undistortion procedure yet. So my feeling is that there should be some bug in the image reading I/O of colmap.
image

@mihaidusmanu
Copy link
Owner

Do you by any chance have one such image where the undistortion fails at hand? I can try to look into it and submit a fix upstream if I figure it out.

@cailile
Copy link

cailile commented Jun 2, 2024

Do you by any chance have one such image where the undistortion fails at hand? I can try to look into it and submit a fix upstream if I figure it out.

I believe images from MegaDepth_v1_SfM/5017 can be used for debugging. From cameras.txt, you can see that images from this scene is captured by 1 camera:
image
The camera width and height is 2000, 1500. However, with colmap 3.7, I got the following error when running the undistortion script:
image

And I have checked the image size for all the images in MegaDepth_v1_SfM/5017/images, all of them has width 2000 and height 1500.

I believe the undistortion program iterate the images according to the order specified in images.txt. Since it fails at the first one, I think the corresponding image would be the first one in images.txt, which is:
image_id 560: P1080890.JPG
(though I suspect that all images in this scene would fail)

@LiusongyanYNU
Copy link

LiusongyanYNU commented Oct 26, 2024

Do you by any chance have one such image where the undistortion fails at hand? I can try to look into it and submit a fix upstream if I figure it out.

I believe images from MegaDepth_v1_SfM/5017 can be used for debugging. From cameras.txt, you can see that images from this scene is captured by 1 camera: image The camera width and height is 2000, 1500. However, with colmap 3.7, I got the following error when running the undistortion script: image

And I have checked the image size for all the images in MegaDepth_v1_SfM/5017/images, all of them has width 2000 and height 1500.

I believe the undistortion program iterate the images according to the order specified in images.txt. Since it fails at the first one, I think the corresponding image would be the first one in images.txt, which is: image_id 560: P1080890.JPG (though I suspect that all images in this scene would fail)

I observe that the size of some images in the folder 5017 is '2000 * 1500', and others are '1500 * 2000'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants