mapillary / mapillary_tools

Command line tools for processing and uploading Mapillary imagery
BSD 2-Clause "Simplified" License
267 stars 138 forks source link

--duplicate_distance will never be true without --duplicate_angle also being true #504

Closed smellyspice closed 2 years ago

smellyspice commented 2 years ago

Basic information

Steps to reproduce behavior

  1. Series of geo located images where I stopped at a red light for a few mins, then continued
  2. specify option --duplicate_distance 5 without--duplicate_angle
  3. Cluster of images expected to be excluded due to lingering at the red stop light are still included

Expected behavior

expected images skipped due to MapillaryDuplicationError

Actual behavior

Images not skipped

Corresponding data

Images imported into EasyGPS to view relative position of images: https://screencast-o-matic.com/i/c3fZrKVYZrE

Additional information

I think the problem is in the logic here: https://github.com/mapillary/mapillary_tools/blob/4bfebf8705d06d8568619cc0c6b83fd3d4fad95e/mapillary_tools/process_sequence_properties.py#L97 A true in distance_duplicated will never get appended if angle_duplicated doesn't also evalute to true

When I change line 97 to: if distance_duplicated: # and angle_duplicated: I correctly get the clustered images at the stop light removed as duplicates. See: https://screencast-o-matic.com/i/c3fZrLVYZ33

Thanks, Rob

ptpt commented 2 years ago

This is expected. Mapillary Tools consider images both at the same point (<= distance_duplicated) and at the same angle (<= angle_duplicated) as duplicated. Because photos taken at the same point but in different directions could be still useful ;)

To solve this problem (or any other 360 camera), you can try specify --distance_duplicated 5 --angle_duplicated 360 to disable the angle duplication check.

smellyspice commented 2 years ago

@ptpt - Thanks for the quick reply and workaround.

No doubt being able to process images at the same location in different directions is useful. However, --duplicate_angle is an optional filter and by not using it, I would expect the application not to perform any angle dup checks!

Perhaps the fix here is to either change the default value to 360 so it acts disabled by default (as you suggest) or to update the documentation to make it clear that this option goes active with a default value of 5 whenever --duplicate_distance is used. This might clear up future confusion. I honestly prefer the former over the latter, since if angle calcs were important to me, I'd have used that filter in the first place! :)

brunnerpaul commented 2 years ago

Thanks to you both for raising this issue and providing a workaround.

I agree with everything in @smellyspice's last comment, following his suggestion would surely help many users (otherwise we have to rely on users finding this thread here for the workaround).

ptpt commented 2 years ago

Thanks for the input and sorry for the confustion here. Hard to change the defaults because it has been there for a while. We can definitely clarify it in the manual or docs. Will fix it in the next release.

littlebtc commented 2 years ago

And it seems that interpolate will run after the duplication check, means there is no way to remove duplication if there is no direction in the source EXIF.

I hope it should be somehow clarify or fixed too? (I switched to GoPro Hero 10 and went into this issue processing timelapse JPGs)

ptpt commented 2 years ago

Let me know if it makes sense to you

  --duplicate_distance DUPLICATE_DISTANCE
                        The maximum distance that can be considered "too
                        close" between two images. If both images also point
                        in the same direction (see --duplicate_angle), the
                        later image will be marked as duplicate and will not
                        be upload. [default: 0.1]
  --duplicate_angle DUPLICATE_ANGLE
                        The maximum camera angle difference between two images
                        to be considered as heading in the same direction. If
                        both images are also close to each other (see
                        --duplicate_distance), the later image will be marked
                        as duplicate and will not be upload. [default: 5.0]