Viable masking by editing raw images?

This topic has closed: 3D Model - Mask , but would have been the place for this question.

Just for fun I am attempting to make a 3D model of a jug on a table, but in some images there are parts of the fridge in the background. When the 3D model is made, the bits of fridge in the background cause the centre of the image to be ~half way between the jug and the fridge, ie well away from the jug. Because of this, moving the image around in 3D means continually having to zoom in or out, and also makes it difficult to view from some angles.

Would a viable method to fix this be to manually black out the unwanted parts of some images and use them in the image set? Would this mean no need for a set of mask images?

2 Likes

You know… That is a great question!

I think it would work. Do you have a small enough test set to try?

I think its worth to try and if successful it can reduce dependency of image mask support.
Please keep us updated :grinning:

1 Like

After a number of half hour runs, the process is not completing. In the first few runs, there were still a few points in the point cloud on the floor near the fridge (although they did disappear once the textured model was applied).
I then went through the raw images to blank out images including that part of the floor, but that caused the process to fail.

[Task #52a32667-1a8c-46ae-9ab4-c308a1f0e1f3](javascript:void(0):wink:
52
00:33:47
Created on: 18/07/2021, 15:50:54
Processing Node: node-odm-1 (manual)
Options: feature-quality: ultra, ignore-gsd: true, mesh-octree-depth: 12, mesh-size: 250000, pc-geometric: true, pc-quality: ultra, pc-rectify: true, use-3dmesh: true

Here is the end of the console text:

[INFO] Running odm_dem stage
[WARNING] Not georeferenced, using ungeoreferenced point cloud…
[INFO] Classify: True
[INFO] Create DSM: False
[INFO] Create DTM: False
[INFO] DEM input file C:\WebODM\resources\app\apps\NodeODM\data\3e8ea084-ba29-4f76-9a92-4aba88f07626\odm_georeferencing\odm_georeferenced_model.laz found: True
[INFO] Classifying C:\WebODM\resources\app\apps\NodeODM\data\3e8ea084-ba29-4f76-9a92-4aba88f07626\odm_georeferencing\odm_georeferenced_model.laz using Simple Morphological Filter
[INFO] running pdal translate -i C:\WebODM\resources\app\apps\NodeODM\data\3e8ea084-ba29-4f76-9a92-4aba88f07626\odm_georeferencing\odm_georeferenced_model.laz -o C:\WebODM\resources\app\apps\NodeODM\data\3e8ea084-ba29-4f76-9a92-4aba88f07626\odm_georeferencing\odm_georeferenced_model.laz smrf --filters.smrf.scalar=1.25 --filters.smrf.slope=0.15 --filters.smrf.threshold=0.5 --filters.smrf.window=18.0
(pdal translate filters.smrf Warning) SMRF running with a small number of cells (12). Consider changing cell size.
[INFO] Created C:\WebODM\resources\app\apps\NodeODM\data\3e8ea084-ba29-4f76-9a92-4aba88f07626\odm_georeferencing\odm_georeferenced_model.laz in 0:00:12.201972
[INFO] running pdal translate -i C:\WebODM\resources\app\apps\NodeODM\data\3e8ea084-ba29-4f76-9a92-4aba88f07626\odm_georeferencing\odm_georeferenced_model.laz -o C:\WebODM\resources\app\apps\NodeODM\data\3e8ea084-ba29-4f76-9a92-4aba88f07626\odm_georeferencing\tmp.las
[INFO] Rectifying C:\WebODM\resources\app\apps\NodeODM\data\3e8ea084-ba29-4f76-9a92-4aba88f07626\odm_georeferencing\odm_georeferenced_model.laz using with [reclassify threshold: 5, min area: 750, min points: 500]
Traceback (most recent call last):
File “C:\WebODM\resources\app\apps\ODM\opendm\dem\commands.py”, line 55, in rectify
run_rectification(
File “C:\WebODM\resources\app\apps\ODM\opendm\dem\ground_rectification\rectify.py”, line 24, in run_rectification
point_cloud = extend_cloud(point_cloud, kwargs[‘extend_plan’], kwargs[‘extend_grid_distance’], kwargs[‘min_points’], kwargs[‘min_area’])
File “C:\WebODM\resources\app\apps\ODM\opendm\dem\ground_rectification\rectify.py”, line 64, in extend_cloud
grid_2d = build_grid(bounds, ground_cloud, distance)
File “C:\WebODM\resources\app\apps\ODM\opendm\dem\ground_rectification\grid\builder.py”, line 17, in build_grid
return __calculate_lonely_points(grid_inside, point_cloud, distance)
File “C:\WebODM\resources\app\apps\ODM\opendm\dem\ground_rectification\grid\builder.py”, line 29, in __calculate_lonely_points
count = ball_tree.query_radius(grid, distance - EPSILON, count_only=True)
File “sklearn\neighbors_binary_tree.pxi”, line 1468, in sklearn.neighbors._ball_tree.BinaryTree.query_radius
File “C:\WebODM\resources\app\apps\ODM\venv\lib\site-packages\sklearn\utils\validation.py”, line 72, in inner_f
return f(**kwargs)
File “C:\WebODM\resources\app\apps\ODM\venv\lib\site-packages\sklearn\utils\validation.py”, line 650, in check_array
raise ValueError(“Found array with %d sample(s) (shape=%s) while a”
ValueError: Found array with 0 sample(s) (shape=(0, 2)) while a minimum of 1 is required.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\WebODM\resources\app\apps\ODM\run.py”, line 54, in
retcode = app.execute()
File “C:\WebODM\resources\app\apps\ODM\stages\odm_app.py”, line 125, in execute
raise e
File “C:\WebODM\resources\app\apps\ODM\stages\odm_app.py”, line 89, in execute
self.first_stage.run()
File “C:\WebODM\resources\app\apps\ODM\opendm\types.py”, line 340, in run
self.next_stage.run(outputs)
File “C:\WebODM\resources\app\apps\ODM\opendm\types.py”, line 340, in run
self.next_stage.run(outputs)
File “C:\WebODM\resources\app\apps\ODM\opendm\types.py”, line 340, in run
self.next_stage.run(outputs)
[Previous line repeated 6 more times]
File “C:\WebODM\resources\app\apps\ODM\opendm\types.py”, line 321, in run
self.process(self.args, outputs)
File “C:\WebODM\resources\app\apps\ODM\stages\odm_dem.py”, line 71, in process
commands.rectify(dem_input, args.debug)
File “C:\WebODM\resources\app\apps\ODM\opendm\dem\commands.py”, line 72, in rectify
raise Exception(“Error rectifying ground in file %s: %s” % (lasFile, str(e)))
Exception: Error rectifying ground in file C:\WebODM\resources\app\apps\NodeODM\data\3e8ea084-ba29-4f76-9a92-4aba88f07626\odm_georeferencing\odm_georeferenced_model.laz: Found array with 0 sample(s) (shape=(0, 2)) while a minimum of 1 is required.

1 Like

Absolutely. This is the simpler way to handle masking and works great. Just be sure not to crop.

3 Likes

Do you think they might need to bump feature-quality and/or min-num-features since they’re masking and background features certainly can be used as tiepoints (which will now be dropped)?

1 Like

Maybe. I haven’t needed to, but I always collect too much data…

2 Likes

OK, another go at it worked! Just using defaults for 3D, with reduced mesh size and features number.

Options: mesh-octree-depth: 12, mesh-size: 150000, min-num-features: 7000, pc-quality: high, use-3dmesh: true

There are a few holes and defects in the point cloud/textures (other side of jug), but only because I didn’t take enough images.
These were taken with my phone, and there were only 51 images.

jug

It’s a good starting point for me to progress with better quality 3D images, but I am quite impressed with the Output from WebODM from such a small number of images. :smiley:

It was quite fast too: 00:10:35

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.