Skip to content

Undistort images together with masks #2361

Open

Description

@ckrsls

Hello developers,

Thank you for this great project. I have a question. I have successfully undistorted my RGB images into ideal pinhole intrinsics with command line colmap image_undistorter. But my masks keep the original size. How can I undistort my masks?

Thank you so much for your help.

Activity

  1. jaco001 commented on Jan 25, 2024

    @jaco001

    Just don't let Colmap to resize/crop images in images files.
    How?
    Use two parameters
    --max_image_size xxxx yyyy
    (where xxxx is width and yyyy height that you want to keep)
    and
    --min_scale x
    (x defaul in Colmap 3.8 is 0.2, set it around 0.96 to 1.04. Experiment with it)

    Check if Colmap do images in size that you want and you can keep masks.

  2. saswat0 commented on Oct 5, 2024

    @saswat0

    @ckrsls Were you able to find a workaround?

  3. xiety commented on Oct 18, 2026

    @xiety

    I use this workaround:

    • Export data from COLMAP using File\Export model as text menu.
    • Replace in exported images.txt file all .jpg occurrences with .jpg.png.
    • Run this command: COLMAP.bat image_undistorter --image_path "<original masks folder>" --input_path "<exported text data folder>" --output_path "<new folder with results>" --output_type COLMAP
  4. cola1917 commented on Oct 27, 2026

    @cola1917
    Contributor

    I am working on adding an optional mask_path to image_undistorter (COLMAP output) and pycolmap.undistort_images. The masks will use the same output camera/crop/resolution as their images, with nearest-neighbor sampling and PNG output under masks/. I plan to keep the existing image mask naming convention, validate masks for selected images, and cover distortion, downscaling, and already-undistorted images with regression tests.

  5. laserpanda commented on Nov 2, 2026

    @laserpanda

    sorry to open up this again.
    how about using the alpha from png as mask and also write the undistorted alpha into the undistorted images?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions