Open ymei opened 11 months ago
I'm having the same issue. Did you manage to sort this out?
I'm having the same issue. Did you manage to sort this out?
No, the problem persists.
I've been hacking at this for quite a while. I believe this commit introduced a regression:
https://github.com/mapillary/OpenSfM/commit/bf48ad277f29670c3442b533847eb32596b0a422
Commenting that out fixes the problem (but the process still fails for me). I get as far as the ad-hoc sfm logic and it immediately fails saying that the images dont exist (but they do as simlinks, which is expected based on the code ive looked at)
Aha! I got further along. The trick was to pass the absolute path to the input dataset when running opensfm (it was trying to use a relative path to find the images from the bin directory). Latest error is:
2023-08-22 02:42:03,842 INFO: Reading data for image IMG_0060_4.tif (queue-size=0) [ WARN:0@6.256] global grfmt_tiff.cpp:719 readData OpenCV TIFF: TIFFRGBAImageOK: Sorry, can not handle images with 12-bit samples Traceback (most recent call last): File "/home/ubuntu/OpenSfM/bin/opensfm_main.py", line 25, in
commands.command_runner( File "/home/ubuntu/OpenSfM/opensfm/commands/command_runner.py", line 38, in command_runner command.run(data, args) File "/home/ubuntu/OpenSfM/opensfm/commands/command.py", line 13, in run self.run_impl(data, args) File "/home/ubuntu/OpenSfM/opensfm/commands/create_rig.py", line 15, in run_impl create_rig.run_dataset(dataset, args.method, json.loads(args.definition), True) File "/home/ubuntu/OpenSfM/opensfm/actions/create_rig.py", line 26, in run_dataset rig.create_rigs_with_pattern(data, definition) File "/home/ubuntu/OpenSfM/opensfm/rig.py", line 335, in create_rigs_with_pattern actions.detect_features.run_dataset(subset_data) File "/home/ubuntu/OpenSfM/opensfm/actions/detect_features.py", line 15, in run_dataset features_processing.run_features_processing(data, data.images(), False) File "/home/ubuntu/OpenSfM/opensfm/features_processing.py", line 55, in run_features_processing read_images(process_queue, data, [image], counter, 1, force) File "/home/ubuntu/OpenSfM/opensfm/features_processing.py", line 163, in read_images image_array = data.load_image(image) File "/home/ubuntu/OpenSfM/opensfm/dataset.py", line 108, in load_image return self.io_handler.imread( File "/home/ubuntu/OpenSfM/opensfm/io.py", line 1411, in imread return imread_from_fileobject(fb, grayscale, unchanged, anydepth) File "/home/ubuntu/OpenSfM/opensfm/io.py", line 1235, in imread_from_fileobject raise IOError("Unable to load image") OSError: Unable to load image
Hi @adamjson64, The error seems pretty clear, your 12-bit TIFF images are not supported.
Yes, it was late and I had been at this for hours so my muscle memory reaction was to share the latest error on Github. Apologies.
The aforementioned regression does seem pertinent based on my debugging efforts so far.
I just need to convert my input images into a bitness that OpenCV will process.
Inserting this code in line 655 of dataset. py can solve this problem,maybe
folders = ["images", "segmentations", "masks"]
for folder in folders:
self.io_handler.mkdir_p(os.path.join(subset_dataset_path, folder))
for img_name in images_subset:
import shutil
shutil.copyfile(
os.path.join(self.data_path, "images", img_name),
os.path.join(subset_dataset_path, "images", img_name)
)
subset_dataset = DataSet(subset_dataset_path, self.io_handler)
I have 4 cameras in a rig with camera names
Left-left
,Left-right
,Right-left
, andRight-right
. The image files are namedLeft-left-001.png
... Thecamera:
fieldexif_overrides.json
is set correctly to each corresponding camera name. Normal reconstruction without considering rig runs correctly.However, when I run
opensfm create_rig data camera '{"RIG_CAMERA_ID1": "Left-left", "RIG_CAMERA_ID2": "Left-right", "RIG_CAMERA_ID3": "Right-left", "RIG_CAMERA_ID4": "Right-right"}'
, it shows the following info and error:I could copy all images to
data/rig_calibration/images
first, makerig.py
not to delete them then run again. But then it appears to be reconstructing all the images rather than a select subset of them.And in the end, it fails.
Is this a bug or perhaps I am not using this feature correctly?