colmap / colmap

COLMAP - Structure-from-Motion and Multi-View Stereo
https://colmap.github.io/
Other
7.74k stars 1.53k forks source link

RAW format support & Documentation on Supported Image Format #284

Closed jlpoolen closed 6 years ago

jlpoolen commented 6 years ago

I have a Nikon workflow. Nikon's raw format is Nikon Electronic Format (NEF). Using Adobe Lightroom, I convert without loss the NEF into Digital Negative (DNG). I tried processing DNG photos and got:

Name: DSC_1246.dng ERROR: Failed to read image file format

NEF failed, as well:

Name: DSC_1217.NEF ERROR: Failed to read image file format.

I want to experiment with lossless images. I guess I'll try converting DNG -> TIFF which I hope might be supported.

Is there documentation on what image formats are acceptable?

ahojnnes commented 6 years ago

Lots of formats are supported in theory but COLMAP internally only handles 8bits per channel (gray or RGB).

jlpoolen commented 6 years ago

I've tried to study the code to determine what might be causing the "ERROR: Failed to read image file format". I was unable to determine what the cause is.

I therefore tried an experiment. I opened the firt image 1246's DNG in Photoshop, reduced size to 50% and saved as JPEG. The reduced-size JPEG, located at https://www.dropbox.com/s/zxs57co9qjfwrf0/DSC_1246_halfsize.jpg?dl=0, successfully was read:

Processed file [2/2] Name: DSC_1246.jpg Dimensions: 2008 x 3008 Camera: 64 (RADIAL_FISHEYE) Focal Length: 2062.63px (EXIF) Features: 2337 Elapsed time: 0.374 [minutes]

It looks like pixel dimensions can affect the ability of the reader. The original size of the JPEG is 6016 x 4016. The original JPEG, plus some others, are located at: https://www.dropbox.com/sh/iatnmhrn2kwz0mg/AAADX8lpe_moeun6XdRRz7gia?dl=0

Is there a pixel limitation? If so, what is it or where is there documentation for it? Or is it a memory issue. I have an NVidia CARD. Here's a pastebin of the RUN_TESTS: https://pastebin.com/2rE4xZru What I really would like to know are what are the limitations of photo input and how can I ascertain them? Trial and error?

jlpoolen commented 6 years ago

The faq.rst file touches on this issue under the section "Feature matching fails due to illegal memory access". I'm finding if I submit a JPEG with 6016 Horizontal pixels for "feature extraction", I get memory errors:

ResizePyramid: out of memory FilterH: unknown error FilterV: unknown error FilterH: an illegal memory access was encountered FilterV: an illegal memory access was encountered ...

I'm running some test cases and will update this later.

jlpoolen commented 6 years ago

Here's proof that PNG and TIFF can be read. So in addition to JPEG, PNF and TIFF are supported.

... Feature extraction ...

Processed file [1/1] Name: DSC_1246.png Dimensions: 800 x 1198 Camera: 1 (SIMPLE_RADIAL) Focal Length: 1437.60px (Default) Features: 6020 Elapsed time: 0.010 [minutes]

... Feature extraction ...

Processed file [1/2] Name: DSC_1246.png SKIP: Features for image already extracted. Processed file [2/2] Name: DSC_1246.tif Dimensions: 2008 x 3008 Camera: 2 (SIMPLE_RADIAL) Focal Length: 2062.63px (EXIF) Features: 9139 Elapsed time: 0.053 [minutes] ... Feature extraction

...

Processed file [1/3] Name: DSC_1246.png SKIP: Features for image already extracted. Processed file [2/3] Name: DSC_1246.tif SKIP: Features for image already extracted. Processed file [3/3] Name: DSC_1246_full.png Dimensions: 2008 x 3008 Camera: 3 (SIMPLE_RADIAL) Focal Length: 3609.60px (Default) Features: 9139 Elapsed time: 0.017 [minutes]

jlpoolen commented 6 years ago

I tried an NEF and DNG again, but they failed:

Processed file [4/5] Name: DSC_1247.NEF ERROR: Failed to read image file format. Processed file [5/5] Name: DSC_1248.dng ERROR: Failed to read image file format. Elapsed time: 0.140 [minutes]

So I'm concluding: NEF and DNG from my camera (Nikon 750) cannot be processed. PNG and TIFF may be processed, but there may be adjustments necessary or a reduction of the pixel size. I hope this helps someone else in the future.

tomachinz commented 4 years ago

Im going to try with TIFF. This format is lossless 8 bit good for my needs today.