Openmvg: [exif] Enhance EXIF parsing & camera database checking - Mapir cameras

Created on 17 Mar 2016  路  12Comments  路  Source: openMVG/openMVG

I've been doing tests recently with imagery collected with Mapir cameras and noticed that at some point in the develop branch Global and Incremental SfM started failing, although it worked fine before. Global SfM fails with error message "Invalid input image graph for global SfM".

After some lengthy trial and error I could narrow it down to this commit after which the processing started failing, which obviously seem to have to do with how EXIF data is being parsed. Here's a small dataset to test with.

Any idea on what more specifically can cause the problem?

enhancement question

All 12 comments

Thanks for the dataset sharing, I will have a look.
But you are certainly right, it's certainly a EXIF around problem.
=> BTW, I'm not sure that the Mapir camera is in the sensor camera database.
Do you know it's sensor size?

I'm surprise to hear that it was working before, since the focal length was certainly not computed (since the camera is not registered in the camera sensor database)

Sorry, I forgot to mention. Of course I added an entry to my local camera database - PEAU;MAPIR;4.506. Btw, the producer name in exif data is PEAU PRODUCTIONS, but ImageListing fails to parse names with whitespaces. I found that only specifying the first part of the name works though.

My first investigation show that the exiflibrary reader return this error code:
PARSE_EXIF_ERROR_NO_JPEG.

By lokking more closely, the error is in the code that is checking the JPEG end marker:

// Sanity check: some cameras pad the JPEG image with null bytes at the end.
  // Normally, we should able to find the JPEG end marker 0xFFD9 at the end
  // of the image, but not always. As long as there are null/0xFF bytes at the
  // end of the image buffer, keep decrementing len until an 0xFFD9 is found,
  // or some other bytes are. If the first non-zero/0xFF bytes from the end are
  // not 0xFFD9, then we can be reasonably sure that the buffer is not a JPEG.

As you see in the previous version (master) I commented out the JPEG end checking since it was not robust enough https://github.com/openMVG/openMVG/commit/f49419f092cd488b942acb9f4cc8c9781d6c8a7b#diff-e41706329e1cbdd85e35c813d961d695R158
You can do the same until we find a valid solution.

Your JPEG files end with "0d09 000a" for an unknown reason.
Classic JPEG ends with "00d9"

Wow, that was quite an observation! :) Commenting out those lines surely did the trick. Thanks for your help, Pierre!

@igorti Your problem made me check more points...

  • Simplify the Camera sensor size database:
    since the BRAND is contained in the MODEL string extracted from the exif data I will change the database format from BRAND;MODEL;SENSOR_SIZE to MODEL;SENSOR_SIZE.
  • Update camera datasheet reading & check
    Since camera model is construct as the following: MAKER MODELNAME we have to take care about how to find if the camera sensor size is contained or not in the database.
    Since camera model can be formatted differently ("KODAK Z612 ZOOM DIGITAL CAMERA" to "Kodak EasyShare Z612")

    • we use lower case comparison

    • we ensure that DIGIT based substring have a match

@igorti @rperrot @pyp22 @ORNis
Since this issue have made me change some important part about camera exif|database checking & analysis..., Could you check that SfMInit_ImageListing is still working correctly for your images (-> provide valid focal length for your datasets). Thanks...

It seems ok for me. Same focal length value before and after your commit on the same set.

Thanks @rperrot
@igorti MAPIR camera is now in the database, so it must work with your provided image dataset.

@pmoulon Yes, same focal length as before the changes. Thanks a lot!

You're welcome, you're feedback was appreciated and helps me to fix other points... so it's win win.
Will wait an additional feedback from @ORNis or @pyp22 and I will close the issue.

It's ok for me, on a small sample.

Thanks to everyone for your tests.

Sorry for delay. Tried with some of my datasets. Ok for me too.

Was this page helpful?
0 / 5 - 0 ratings