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

[bug] #601

Closed
jensdk3 opened this issue Aug 22, 2019 · 11 comments
Closed

[bug] #601

jensdk3 opened this issue Aug 22, 2019 · 11 comments
Labels
bug for actual bugs (unsure? use type:question)

Comments

@jensdk3
Copy link

jensdk3 commented Aug 22, 2019

Describe the bug
I have a problem with getting more than a single image file to show in the Images Pane of Meshroom 2019.0.2.
If I drag and drop either one of these two files, the chosen image will show up in the Images Pane. But if I drag both of them from File Explorer, only one will show up.
0-90rot
1-90rot

To Reproduce
Steps to reproduce the behavior:
Open Meshroom 2019.2.0 in Windows 10
Drag the two attached images from File Explorer to Meshroom Image Pane
Error is that only a single image appears in the Images Pane

Expected behavior
I would expect both images to appear in Image Pane.

Screenshots
If applicable, add screenshots to help explain your problem.

Log
Terminal output when importing 1 of the two images:

Plugins loaded:  CameraCalibration, CameraInit, CameraLocalization, CameraRigCalibration, CameraRigLocalization, ConvertSfMFormat, DepthMap, DepthMapFilter, ExportAnimatedCamera, ExportColoredPointCloud, ExportMaya, FeatureExtraction, FeatureMatching, ImageMatching, ImageMatchingMultiSfM, KeyframeSelection, LDRToHDR, MeshDecimate, MeshDenoising, MeshFiltering, MeshResampling, Meshing, PrepareDenseScene, Publish, SfMAlignment, SfMTransform, StructureFromMotion, Texturing
Program called with the following parameters:
 * allowSingleView = 1
 * defaultCameraModel = "" (default)
 * defaultFieldOfView = 45
 * defaultFocalLengthPix = -1 (default)
 * defaultIntrinsic = "" (default)
 * groupCameraFallback =  Unknown Type "enum EGroupCameraFallback"
 * imageFolder = "" (default)
 * input = "C:\Users\jensd\AppData\Local\Temp\tmpa0fvbdmz/CameraInit/c448939571d5c70b05c9ae4ad416ada37d6273ca//viewpoints.sfm"
 * output = "C:/Users/jensd/AppData/Local/Temp/tmpa0fvbdmz/CameraInit/c448939571d5c70b05c9ae4ad416ada37d6273ca/cameraInit.sfm"
 * sensorDatabase = "C:\Users\jensd\Downloads\Meshroom-2019.2.0-win64\Meshroom-2019.2.0\aliceVision\share\aliceVision\cameraSensors.db"
 * verboseLevel = "info"

[22:05:23.436454][info] CameraInit report:
        - # views listed: 1
           - # views with an initialized intrinsic listed: 1
           - # views without metadata (with a default intrinsic): 0
        - # intrinsics listed: 1

Terminal output when importing both images

Plugins loaded:  CameraCalibration, CameraInit, CameraLocalization, CameraRigCalibration, CameraRigLocalization, ConvertSfMFormat, DepthMap, DepthMapFilter, ExportAnimatedCamera, ExportColoredPointCloud, ExportMaya, FeatureExtraction, FeatureMatching, ImageMatching, ImageMatchingMultiSfM, KeyframeSelection, LDRToHDR, MeshDecimate, MeshDenoising, MeshFiltering, MeshResampling, Meshing, PrepareDenseScene, Publish, SfMAlignment, SfMTransform, StructureFromMotion, Texturing
Program called with the following parameters:
 * allowSingleView = 1
 * defaultCameraModel = "" (default)
 * defaultFieldOfView = 45
 * defaultFocalLengthPix = -1 (default)
 * defaultIntrinsic = "" (default)
 * groupCameraFallback =  Unknown Type "enum EGroupCameraFallback"
 * imageFolder = "" (default)
 * input = "C:\Users\jensd\AppData\Local\Temp\tmpa0fvbdmz/CameraInit/c448939571d5c70b05c9ae4ad416ada37d6273ca//viewpoints.sfm"
 * output = "C:/Users/jensd/AppData/Local/Temp/tmpa0fvbdmz/CameraInit/c448939571d5c70b05c9ae4ad416ada37d6273ca/cameraInit.sfm"
 * sensorDatabase = "C:\Users\jensd\Downloads\Meshroom-2019.2.0-win64\Meshroom-2019.2.0\aliceVision\share\aliceVision\cameraSensors.db"
 * verboseLevel = "info"

[22:05:23.436454][info] CameraInit report:
        - # views listed: 1
           - # views with an initialized intrinsic listed: 1
           - # views without metadata (with a default intrinsic): 0
        - # intrinsics listed: 1

Desktop (please complete the following and other pertinent information):

  • OS: Windows 10 64 bit
  • Version 1903
  • Python version 3.6.4 (system) , 3.6.6(meshroom)
  • Binary version 2019.2.0

Additional context
The problem is identical in Meshroom 2019.1.0

@jensdk3 jensdk3 added the bug for actual bugs (unsure? use type:question) label Aug 22, 2019
@natowi
Copy link
Member

natowi commented Aug 22, 2019

I think this problem is related to your synthetic images. How to you generate these images?

@natowi
Copy link
Member

natowi commented Aug 22, 2019

OK, I think the JPG files are corrupted (the file format or the metadata). Converting them to PNG works.
Compression rate of your images is "-32590 (Unknown)"

@jensdk3
Copy link
Author

jensdk3 commented Aug 23, 2019

Thanks for the quick answer. If the files are indeed corrupted, why could I then import either of them without errors? To me, this suggests that corrupted files are not the root cause. Maybe even that the two files are not corrupted, seen from a Meshroom point of view.

@natowi
Copy link
Member

natowi commented Aug 23, 2019

The import module from AliceVision has problems parsing some "abnormal" image files (invalid file formats, custom/unexpected Metadata fields/values)

Some cameras (also virtual cameras) use extra EXIF fields which cause an error when importing images to Meshroom. You could try to strip all uncommon EXIF information and add/keep camera, make, focallength only .
Now the Meshroom import should work. #205 (comment)
You can use Exif tools like Exif Editor or ExifToolGUI.

(I think the 35 mm equivalent focal length in your image metadata can not be 35mm when the focal length is 35mm https://en.wikipedia.org/wiki/35_mm_equivalent_focal_length)

What software and camera exporter do you use?

@jensdk3
Copy link
Author

jensdk3 commented Aug 25, 2019

I use a PBR render software. I set the software to write tif images. Afterwards, I add the specs of the virtual camera to tif file using the following home grown python function:

def writeexifdata(filename, focallength, cropfactor, make, model):
    # See http://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf
    # FocalLength is a Rational and for FocalLength this means a division of integers. For some reason he FocalLengthIn35mmFilm can be an integer. Don't know why FocalLengh cannot...
    # pyexiv2 is very picky with data content and can crash without error messages if data is in unexpected format

    _dict = {
        "Exif.Image.Make": make,
        "Exif.Image.Model": model,
        "Exif.Photo.FocalLength": "{}/10".format(focallength * 10),
        "Exif.Photo.FocalLengthIn35mmFilm": "{}".format(int(focallength * cropfactor)),
        "Exif.Photo.BodySerialNumber": "111",
        "Exif.Photo.LensSerialNumber": "222"
    }

    i = pyexiv2.Image(filename)
    i.clear_all()
    i.modify_exif(_dict)
    # print(i.read_all())

    print('Wrote EXIF data to: ', filename)

It took some time to figure out which meta data was acceptable by pyexiv2 and needed by Meshroom. But the tif+metadata have since then worked reliably in Meshroom 2019.1.0.

It therefore came as a annoying surprise that the same files could not be imported in Meshroom 2019.2.0.

It is easy to reproduce. Just download this zip with two tif images and drag and drop into both versions of Meshroom. You'll see that Meshroom 2019.2.0 does not accept these images simultanerouly and produce the bug I describe above.

twoTestImages.zip

On a greater level, the lack of feedback from Meshroom is quite frustrating when trying to debug these kind of import problems. But that doesn't change the fact, that Meshroom is a great piece of open source software in my mind!

BR
Jens

@natowi
Copy link
Member

natowi commented Aug 25, 2019

I can import both tif images in Meshroom 2019.2

Unbenannt

I get the following Metadata error message in the cli:

CameraInit report:
- # views listed: 2
- # views with an initialized intrinsic listed: 2
- # views without metadata (with a default intrinsic): 0
- # intrinsics listed: 1
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 59932 (0xea1c) encountered.

I´d recommend using ExifTool/ExifToolGUI to add the metadata. ExifTool is known to create valid metadata fields.

@jensdk3
Copy link
Author

jensdk3 commented Aug 25, 2019

It is odd you cannot reproduce.
Did you use or have you tried this version, which is found on https://alicevision.org/#meshroom?
https://www.fosshub.com/Meshroom.html?dwl=Meshroom-2019.2.0-win64.zip

@Heptazane
Copy link

I just ran into this issue. For me, removing LensSerialNumber and BodySerialNumber "solved" the problem. Its like having a matching serial number stopped the image from being added to the list.

@jensdk3
Copy link
Author

jensdk3 commented Aug 31, 2019

Hi Heptazane,
You are right. Thanks for the fix! Maybe it is uncommon to have image file contain a serial number? My Canon 500D doesn't write such data. I just put it in because Meshroom seem to be able to use it.

@natowi
Copy link
Member

natowi commented Sep 18, 2019

I just put it in because Meshroom seem to be able to use it.

Meshroom uses the LensSerialNumber and BodySerialNumber to differentiate cameras/lens combinations (to avoid applying the same parameters for different setups). If you are using the same camera + lens for your dataset (or add a completely different model/make), you don´t need this info.

@natowi natowi closed this as completed Sep 18, 2019
@fabiencastan
Copy link
Member

@jensdk3,
Sorry for missing to answer this issue.

Here is how we create the UID for the input image:
https://github.com/alicevision/AliceVision/blob/25a9de0a482d1b23d604e45800d29c3449d999d0/src/aliceVision/sfmData/uid.cpp#L19

It should use the file date/time if the metadata is not there. So the UID should be unique for each image. So I'm not sure what is your issue coming from.

Best,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug for actual bugs (unsure? use type:question)
Projects
None yet
Development

No branches or pull requests

4 participants