GithubHelp home page GithubHelp logo

sbcv / blender-addon-photogrammetry-importer Goto Github PK

View Code? Open in Web Editor NEW
873.0 43.0 77.0 30.69 MB

Addon to import different photogrammetry formats into Blender

License: MIT License

Python 99.36% Shell 0.39% Batchfile 0.25%
blender-addon photogrammetry structure-from-motion sfm colmap openmvg meshroom open3d blender opensfm

blender-addon-photogrammetry-importer's People

Contributors

baardaap-blender avatar begalov avatar d-tal avatar freakthemighty avatar kant avatar linusnie avatar manurare avatar mnmly avatar mysterypancake avatar pmoulon avatar sbcv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blender-addon-photogrammetry-importer's Issues

Dependency error

On the newest build you just released it appears you added a couple of new dependencies. They do not load up for me, yes I'm patient :)

In the console on Windows 10 using 2.92 Alpha most recent build, I get the following error: (btw, I ran this as Administrator)

image

_Edit: just tried this in 2.91 and it works!

2nd Edit: I'm pretty sure this is a Blender 2.92 Alpha issue as the Python Module Manager that was working two days ago is no longer fully functional._

Dependencies are installed but not found

I would like to use this add-on for importing point cloud data with color.
I'm using blender 2.93. I've installed this add-on and tried downloading and installing the optional dependencies using the GUI. It seems to install the dependencies, however the GUI still says that they are not installed, even after restarting blender.

This is what is printed to the command line:

INFO:root:INFO: Registered Photogrammetry Import Export Addon with 52 modules
INFO:root:INFO: Installing pip!
Defaulting to user installation because normal site-packages is not writeable
Looking in links: /tmp/tmpgh9pe92n
Requirement already satisfied: setuptools in ./.local/lib/python3.9/site-packages (49.2.1)
Requirement already satisfied: pip in ./.local/lib/python3.9/site-packages (21.2.4)
/home/myname/.config/blender/2.93/scripts/addons/photogrammetry_importer/preferences/dependency.py:122: RuntimeWarning: Use 'sys.executable' instead of 'binary_path_python'!
  python_exe_fp = bpy.app.binary_path_python
INFO:root:INFO: Installing dependency with ['/snap/blender/460/2.93/python/bin/python3.9', '-m', 'pip', 'install', '--no-cache-dir', 'pillow']
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pillow in ./.local/lib/python3.9/site-packages (8.3.1)
INFO:root:INFO: Installing pip!
Defaulting to user installation because normal site-packages is not writeable
Looking in links: /tmp/tmp8fwcxe8j
Requirement already satisfied: setuptools in ./.local/lib/python3.9/site-packages (49.2.1)
Requirement already satisfied: pip in ./.local/lib/python3.9/site-packages (21.2.4)
INFO:root:INFO: Installing dependency with ['/snap/blender/460/2.93/python/bin/python3.9', '-m', 'pip', 'install', '--no-cache-dir', 'lazrs']
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: lazrs in ./.local/lib/python3.9/site-packages (0.2.5)
INFO:root:INFO: Installing pip!
Defaulting to user installation because normal site-packages is not writeable
Looking in links: /tmp/tmps4ghxu04
Requirement already satisfied: setuptools in ./.local/lib/python3.9/site-packages (49.2.1)
Requirement already satisfied: pip in ./.local/lib/python3.9/site-packages (21.2.4)
INFO:root:INFO: Installing dependency with ['/snap/blender/460/2.93/python/bin/python3.9', '-m', 'pip', 'install', '--no-cache-dir', 'pylas']
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pylas in ./.local/lib/python3.9/site-packages (0.4.3)
Requirement already satisfied: numpy in ./.local/lib/python3.9/site-packages (from pylas) (1.21.2)
INFO:root:INFO: Installing pip!
Defaulting to user installation because normal site-packages is not writeable
Looking in links: /tmp/tmpqu_o_dja
Requirement already satisfied: setuptools in ./.local/lib/python3.9/site-packages (49.2.1)
Requirement already satisfied: pip in ./.local/lib/python3.9/site-packages (21.2.4)
INFO:root:INFO: Installing dependency with ['/snap/blender/460/2.93/python/bin/python3.9', '-m', 'pip', 'install', '--no-cache-dir', 'pyntcloud']
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyntcloud in ./.local/lib/python3.9/site-packages (0.1.5)
Requirement already satisfied: pandas in ./.local/lib/python3.9/site-packages (from pyntcloud) (1.3.2)
Requirement already satisfied: scipy in ./.local/lib/python3.9/site-packages (from pyntcloud) (1.7.1)
Requirement already satisfied: numpy in ./.local/lib/python3.9/site-packages (from pyntcloud) (1.21.2)
Requirement already satisfied: pytz>=2017.3 in ./.local/lib/python3.9/site-packages (from pandas->pyntcloud) (2021.1)
Requirement already satisfied: python-dateutil>=2.7.3 in ./.local/lib/python3.9/site-packages (from pandas->pyntcloud) (2.8.2)
Requirement already satisfied: six>=1.5 in ./.local/lib/python3.9/site-packages (from python-dateutil>=2.7.3->pandas->pyntcloud) (1.16.0)
Info: Installing pip!
Info: Installing dependency with ['/snap/blender/460/2.93/python/bin/python3.9', '-m', 'pip', 'install', '--no-cache-dir', 'pillow']
Info: Installing pip!
Info: Installing dependency with ['/snap/blender/460/2.93/python/bin/python3.9', '-m', 'pip', 'install', '--no-cache-dir', 'lazrs']
Info: Installing pip!
Info: Installing dependency with ['/snap/blender/460/2.93/python/bin/python3.9', '-m', 'pip', 'install', '--no-cache-dir', 'pylas']
Info: Installing pip!
Info: Installing dependency with ['/snap/blender/460/2.93/python/bin/python3.9', '-m', 'pip', 'install', '--no-cache-dir', 'pyntcloud']

Export Screenshot Sequence

I apologize if I am doing something wrong. Export Screenshot Sequence always worked for me in previous versions of the addon with Blender 2.8. With Version 3.0 of the addon using Blender 3.1.2, I get the following message when executing Export Screenshot Sequence:

Python: Traceback (most recent call last):
File "C:\Users\MyName\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\photogrammetry_importer\panels\screenshot_operators.py", line 137, in execute
bpy.ops.screen.screenshot(
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\modules\bpy\ops.py", line 132, in call
ret = _op_call(self.idname_py(), None, kw)
TypeError: Converting py args to operator properties: : keyword "full" unrecognized

location: :-1

Export screenshot sequence: ...
Output File Path: C:\Users\MyName\Downloads\Stabilize Project\Blender\Screenshot\00001.png
Python: Traceback (most recent call last):
File "C:\Users\MyName\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\photogrammetry_importer\panels\screenshot_operators.py", line 137, in execute
bpy.ops.screen.screenshot(
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\modules\bpy\ops.py", line 132, in call
ret = _op_call(self.idname_py(), None, kw)
TypeError: Converting py args to operator properties: : keyword "full" unrecognized

location: :-1

Meshroom import

Hi,
does this importer support both 2018 and 2019 meshroom files ?
There are some differences in the json, and as 2019 still has some bugs i sometimes must rely on 2018 one.

No camera imported while importing NVM from the example and my personal nvm file from agisoft metashape in blender 3.1.1

Hi,

I'm trying to let blender read my camera info and combine them into an animated camera by using this plugin.
I imported my personal nvm file that i exported from metashape (camera - > export -> select nvm format) into blender and checked add camera motion as an animation. but there is no camera shown in blender only point cloud.

So i tried with the provided examples - VisualSFM_example.nvm. It still only imported point cloud. please help.

Thanks in advance!
J

Accessing this addon from Python script for batch processing

Hey,

Really helpful addon, thanks!

I am just trying to use it as part of a batch processing pipeline that takes in videos in to colmap, produce 3d point clouds and render them out from the camera angles, so this is really helpful. There are roughly 50 different vids/objs so it would be great to be able to write a script to run through them all and import each one at a time with this addon.

I had a look at your code a bit and a bit elsewhere, could it be accessed through bpy.import? or would you recommend i try to access the classes directly from your scripts?

Thanks a lot and great work,
George

I get an import error.

Looking at the blender info, it seems that there is an error on line 576 and line 269 of A. Is there a workaround?

Python: Traceback (most recent call last):
File "C:\Users\YY\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\photogrammetry_importer\operators\meshroom_import_op.py", line 107, in execute
) = MeshroomFileHandler.parse_meshroom_file(
File "C:\Users\YY\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\photogrammetry_importer\file_handlers\meshroom_file_handler.py", line 576, in parse_meshroom_file
cams, points = cls.parse_meshroom_sfm_file(
File "C:\Users\YY\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\photogrammetry_importer\file_handlers\meshroom_file_handler.py", line 269, in parse_meshroom_sfm_file
) = cls._parse_cameras_from_json_data(
File "C:\Users\YY\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\photogrammetry_importer\file_handlers\meshroom_file_handler.py", line 136, in _parse_cameras_from_json_data
raise NotImplementedError
NotImplementedError

Import Error

I can't get it to work. Tried all the variations for the path as well as leaving string empty and coping images to json folder and always get this error:
Traceback (most recent call last):
File "C:\Users\Adm\Desktop\blender-2.80-windows64\2.80\scripts\addons\photogrammetry_importer\photogrammetry_import_op.py", line 200, in execute
path, self.path_to_images, self)
File "C:\Users\Adm\Desktop\blender-2.80-windows64\2.80\scripts\addons\photogrammetry_importer\file_handler\meshroom_json_file_handler.py", line 146, in parse_meshroom_file
cams, image_index_to_camera_index = MeshroomJSONFileHandler.parse_cameras(json_data, op)
File "C:\Users\Adm\Desktop\blender-2.80-windows64\2.80\scripts\addons\photogrammetry_importer\file_handler\meshroom_json_file_handler.py", line 23, in parse_cameras
views = json_data['views'] # is a list of dicts (view)
KeyError: 'views'

location: :-1

keep getting error loading

Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\modules\addon_utils.py", line 351, in enable
mod = import(module_name)
File "C:\Users\Guillermo\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\photogrammetry_importer_init_.py", line 42, in
modules = developer_utils.setup_addon_modules(path, name, "bpy" in locals())
File "C:\Users\Guillermo\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\photogrammetry_importer\developer_utils.py", line 39, in setup_addon_modules
modules = import_submodules(names)
File "C:\Users\Guillermo\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\photogrammetry_importer\developer_utils.py", line 30, in import_submodules
modules.append(importlib.import_module("." + name, package_name))
File "C:\Program Files\Blender Foundation\Blender\2.80\python\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\Guillermo\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\photogrammetry_importer\photogrammetry_import_op.py", line 9, in
from photogrammetry_importer.file_handler.meshroom_json_file_handler import MeshroomJSONFileHandler
File "C:\Users\Guillermo\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\photogrammetry_importer\file_handler\meshroom_json_file_handler.py", line 4, in
from PIL import Image
ModuleNotFoundError: No module named 'PIL'

your suggetion

Meshroom format no longer imports SFM points in v3.1.2

Today, I upgraded to v3.1.2 of this add-on, and now, Meshroom import for ConvertSFMFormatNode no longer generates points for the sparse cloud. I was hoping that in v3.1.2, another longstanding issue has been fixed (the inability to export points in Colmap format). Even in an older plugin version (3.0.0), Meshroom points would import properly, but would disappear when attempting to export to Colmap (the points3d.bin file is completely empty). It would be nice to have the ability to convert between Meshroom and Colmap formats. Please let me know when you expect this functionality to be working. The other add-in is also unable to generate points from Meshroom data.

error when importing colmap folder into blender through the plugin

#5
when attempting to imort colmap folder (the model is exported as text from colmap resulting in camera, images, points3D .txt files) i get an error and nothing is loaded in blender.
however for some reason the example colmap folder that comes with the addon imports fine.

the error i get is this:
Traceback (most recent call last):
File "C:\Users\ariel caine\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\photogrammetry_importer\photogrammetry_import_op.py", line 81, in execute
cameras, points = ColmapFileHandler.parse_colmap_model_folder(path, self)
File "C:\Users\ariel caine\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\photogrammetry_importer\file_handler\colmap_file_handler.py", line 146, in parse_colmap_model_folder
id_to_col_cameras, id_to_col_images, op)
File "C:\Users\ariel caine\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\photogrammetry_importer\file_handler\colmap_file_handler.py", line 87, in convert_cameras
assert len(camera_models) == 1
AssertionError

location: :-1

location: :-1

Blender 2.81 ?

Might be Installation problem in 2.81. Though installed it is not showing .SFM format type in Import menu

Show active 3d points per frame?

Thanks for sharing this great tool.
Is there a way easily show only the active 3d points for every frame, meaning just the 3d solved points that are visible and relevant to each frame? Kind of like how After Effects displays the 3d points in their camera tracker. I see in the Colmap txt files that get exported that it gives us this information.

Exporting to NVM from ply

Thank you for the great addon.

I have got ply file which is the pointcloud, list.txt that has all the image paths, bundler.out file.

How do I import it into blender and export everything together as nvm file?

LAZ import error: pyo3_runtime.PanicException: index out of range

I am trying to import a laz file, but I get the following error:

location: <unknown location>:-1
INFO:root:INFO: path: C:\gis\data\temp_data\blender\L4142G1\L4142G1_2.laz
INFO:root:INFO: Parse Point Data File: ...
thread '<unnamed>' panicked at 'index 108347 out of range for slice of length 108339', src\libcore\slice\mod.rs:2725:5
Python: Traceback (most recent call last):
  File "C:\Users\Topi Tjukanov\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\photogrammetry_importer\operators\point_data_import_op.py", line 49, in execute
    points = PointDataFileHandler.parse_point_data_file(path, self)
  File "C:\Users\Topi Tjukanov\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\photogrammetry_importer\file_handlers\point_data_file_handler.py", line 238, in parse_point_data_file
    point_cloud = PyntCloud.from_file(ifp)
  File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pyntcloud\core_class.py", line 130, in from_file
    return cls(**FROM_FILE[ext](filename, **kwargs))
  File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pyntcloud\io\las.py", line 90, in read_las
    data = read_las_with_pylas(filename)
  File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pyntcloud\io\las.py", line 64, in read_las_with_pylas
    las = las_file.read()
  File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pylas\lasreader.py", line 64, in read
    points = self._read_points(vlrs)
  File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pylas\lasreader.py", line 114, in _read_points
    points = self._read_compressed_points_data(laszip_vlr, point_format)
  File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pylas\lasreader.py", line 136, in _read_compressed_points_data
    decompressed_points = lazrs_decompress_buffer(
  File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pylas\compression.py", line 64, in lazrs_decompress_buffer
    lazrs.decompress_points(point_compressed, vlr_data, point_decompressed, parallel)
pyo3_runtime.PanicException: index 108347 out of range for slice of length 108339

location: <unknown location>:-1

You can download the file I used here

Exporting all locations of the animated camera

Firstly, thanks for the wonderful plugin. I'm attempting to export all locations of the animated camera, including the interpolated locations and wondering if this is currently supported ?

I noticed that exporting the model outputs a single line for the current animated camera location. What I'd like to do is output multiple of such locations to file as said camera navigates the trajectory.

Thanks once again and looking forward to hearing from you.

nvm file

When nvm is imported in blender, the rendered image using camera position and orientation does not generate same image as corresponding to given RGB image.

I think origin changes when nvm is imported in Blender.

And can you please help to load RGB values corresponding to point cloud ?

Thanks

Import, save BLEND, open BLEND, color is black

I tested this many times, basically importing seems to work fine, I am getting the color on 3D view, I can render at this point.

If I save and re-open the BLEND, however, I am getting black on Particle Color.

Is there something that I forgot to do? Maybe can I save Particle Color as Texture, if we can remesh it?

How is managed lens distorsion by this addon?

I exported from Agisoft Metashape both camera poses (using .nvm format), undistorted pictures as jpegs and markers as dxf.

I later imported the .nvm in blender using this extension alongside the .dxf with the marker location.

Sadly markers are misplaced in respect to their feature points as you can see from the attached picture

Snipaste_2022-11-22_15-54-20

As you can see in Metashape this markers are perfectly placed (screenshot taken from 3d view looking through the camera)
image

point cloud colors

Hi,

I have just discovered this awesome addon and the point cloud importing phase works just fine, but then, i've some issue accesing the colors for the PC.
I haven't find where the color for each vertex is stored.

I'm trying this with new Blender 3.1 and the new node Mesh to point.

Only gray plane is show, no image displayed

Tried loading the example projects

Environment:

Ubuntu 18.04
latest master

log:

bpy.context.space_data.params.directory = "/home/yibo/workspace/make/Blender-Addon-Photogrammetry-Importer/examples/"
bpy.data.window_managers["WinMan"].(null) = "/home/yibo/workspace/make/Blender-Addon-Photogrammetry-Importer/examples/images"
bpy.data.window_managers["WinMan"].(null) = False
bpy.data.window_managers["WinMan"].(null) = False
path: /home/yibo/workspace/make/Blender-Addon-Photogrammetry-Importer/examples/OpenMVG_example.json
image_dp: /home/yibo/workspace/make/Blender-Addon-Photogrammetry-Importer/examples/images
parse_openmvg_file: ...
input_openMVG_file_path: /home/yibo/workspace/make/Blender-Addon-Photogrammetry-Importer/examples/OpenMVG_example.json
Can not compute point cloud color information, since Pillow is not installed.
parse_openmvg_file: Done
Number cameras: 11
Number points: 5953
Adding Cameras: ...
Adding image planes: False
Adding depth maps as point cloud: True
Duration: 0.0016970634460449219
Adding Cameras: Done
Add particle draw handlers

Color when importing ply

Hi,
First of all, thanks a lot for this addon ! It is nice being able to map a particle system onto the point cloud !
Somehow I'm not able to see the colors from the photogrammetry done with metashape...
Is this normal when I'm not doing the point cloud calculation within Blender with this addon ?

Regard3D/OpenMVG workflow

Hello everyone,
For those who didn't read the first issue I posted, this is about problems that can araise with the Regard3D/OpenMVG workflow.

This addon relies on json files for Regard3D/OpenMVG import. OpenMVG has a tool to convert sfm_data.bin to cameras.json (using openMVG_main_ConvertSfM_DataFormat.exe -i sfm_data.bin -o cameras.json -V -I -E (-S -C are optionnal)).

Using this simple command line, one can convert Regard3D sfm_data files into camera info as json files. So far so good.

The main issue is that this command line creates json file that this addon cannot parse correctly.

Here is the intrinsics that seem to cause the bug:

"intrinsics": [
{
"key": 0,
"value": {
"polymorphic_id": 2147483649,
"polymorphic_name": "pinhole_radial_k3",
"ptr_wrapper": {
"id": 2147483745,
"data": {
"width": 4000,
"height": 6000,
"focal_length": 15193.06853136843,
"principal_point": [
2010.6631635894829,
3013.5288307892844
],
"disto_k3": [
0.23547542621624013,
1.0377324669468973,
25.664009974069687
]
}
}
}
},
{
"key": 1,
"value": {
"polymorphic_id": 1,
"ptr_wrapper": {
"id": 2147483746,
"data": {
"width": 6000,
"height": 4000,
"focal_length": 26837.64213005792,
"principal_point": [
3024.948789263701,
2005.5551594699007
],
"disto_k3": [
1.308115485771672,
23.88648384690404,
-560.0914521542329
]
}
}
}
},
{
"key": 2,
"value": {
"polymorphic_id": 1,
"ptr_wrapper": {
"id": 2147483747,
"data": {
"width": 6000,
"height": 4000,
"focal_length": 25512.9448045926,
"principal_point": [
3061.900325109015,
1997.2968905128087
],
"disto_k3": [
1.5001251036783452,
-26.644358754059213,
1921.1474880697998
]
}
}
}
},
{
"key": 3,
"value": {
"polymorphic_id": 1,
"ptr_wrapper": {
"id": 2147483748,
"data": {
"width": 4000,
"height": 6000,
"focal_length": 14108.98059220295,
"principal_point": [
2004.5743060023872,
3021.6981645876114
],
"disto_k3": [
0.136069949695253,
0.7672774745376262,
16.480312185674408
]
}
}
}
},
{
"key": 4,
"value": {
"polymorphic_id": 1,
"ptr_wrapper": {
"id": 2147483749,
"data": {
"width": 6000,
"height": 4000,
"focal_length": 14123.264459113307,
"principal_point": [
3046.6720924000785,
2035.155786688224
],
"disto_k3": [
0.03136966972788541,
7.1919426547408709,
-114.82146264426034
]
}
}
}
},
{
"key": 5,
"value": {
"polymorphic_id": 1,
"ptr_wrapper": {
"id": 2147483750,
"data": {
"width": 6000,
"height": 4000,
"focal_length": 17775.452419755573,
"principal_point": [
3034.855326792158,
2035.176286944217
],
"disto_k3": [
0.42808247529376267,
6.4239000531778649,
-58.24064251915535
]
}
}
}
}
]

The parser needs to find "polymorphic_name" in every intrinsic field. What is weird is that the property is only in the first intrinsic parameter.

So either the parser could consider only first "polymorphic_name" key (in first intrinsic) or the OpenMVG converter should add this key to the json file. For the former though, according to the doc, OpenMVG uses cereal to serialize sfm_data, so the latter is to blame I guess.

Installation problem

Hello, I would like that the instalation of add-on in Blender don't works. Thank you.

Support for additional Libraries

This issue is considered as a living document.

The following libraries will be probably supported in the near future:
OpenSfM (https://github.com/mapillary/OpenSfM)

Feel free suggest other libraries as well. If these are proprietary, please provide a reconstruction of the sceaux castle in a file format that can be reasonably parsed with python. Or even better: provide a pull request ;)

Side note: Here is nice summary (unfortunately in german) of many different SfM tools

Importing a .nvm from metashape radial distortion warning

First I have to say wow this project is great! I'm so happy I found it!

I'm getting a warning after importing a .nvm from metashape;
INFO:root:WARNING: Blender does not support radial distortion of cameras in the 3D View. Distortion of camera Cam001.jpg: {radial_distortion}. If possible, re-compute the reconstruction using a camera model without radial distortion parameters. Use "Suppress Distortion Warnings" in the import settings to suppress this message.

The set does import but looking through the cameras the background image doesn't line up, I presume because of this warning, any advice?

Enhancement of Blender's OpenGL renderer

I've added a proposal to enhance Blender's OpenGL renderer to support the GPU Module as well. This would allow to render/write the full 3D View (e.g. points and cameras with images) to disk.

If you find this feature useful, you can vote for the proposal here.

Known (Blender) Issues

  • bgl.glEnable(bgl.GL_DEPTH_TEST) is broken in Blender 2.90. Thus, the occlusion handling of point clouds in the 3D viewport with OpenGL does not work properly

  • bgl.glEnable(bgl.GL_DEPTH_TEST) causes strange artifacts under Windows. Saving images of point clouds using the photogrammetry importer panel (in the 3D view) might result in black images. Dependending on your use case consider to uncomment the corresponding line

Note: Blender is currently switching from OpenGL to Vulkan, i.e. the bgl module will be deprecated! This could resolve the current rendering issues.

EDIT: See https://developer.blender.org/T85709

EDIT: This bug has been fixed in the latest version of the addon using the new api of Blender 3.0

Error trying to import .las and .laz files

Hi,
These are the errors I get whenever I try to import a .las or .laz file. I've been trying to get this to work for hours, including manually updating and reinstalling various python packages. I'm basically a beginner when it comes to this stuff, please help. Appreciate the addon, used it a bunch for meshroom data.

INFO:root:INFO: path: C:\Users\[name]\Desktop\NUKE\projects\reel\CG_Integration\city_fire_cars\ele\TN_HamiltonCounty_2011_000040.laz
INFO:root:INFO: Parse Point Data File: ...
Python: Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pylas\headers\rawheader.py", line 320, in header_class_for_version
    return cls._version_to_header[str(version)]
KeyError: '1.0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\[name]\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\photogrammetry_importer\operators\point_data_import_op.py", line 49, in execute
    points = PointDataFileHandler.parse_point_data_file(path, self)
  File "C:\Users\[name]\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\photogrammetry_importer\file_handlers\point_data_file_handler.py", line 238, in parse_point_data_file
    point_cloud = PyntCloud.from_file(ifp)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pyntcloud\core_class.py", line 130, in from_file
    return cls(**FROM_FILE[ext](filename, **kwargs))
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pyntcloud\io\las.py", line 90, in read_las
    data = read_las_with_pylas(filename)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pyntcloud\io\las.py", line 63, in read_las_with_pylas
    with pylas.open(filename) as las_file:
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pylas\lib.py", line 66, in open_las
    return LasReader(stream, closefd=closefd)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pylas\lasreader.py", line 39, in __init__
    self.header = self.read_header()
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pylas\lasreader.py", line 45, in read_header
    return headers.HeaderFactory().read_from_stream(self.stream)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pylas\headers\rawheader.py", line 346, in read_from_stream
    header_class = cls.header_class_for_version(version)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pylas\headers\rawheader.py", line 322, in header_class_for_version
    raise errors.FileVersionNotSupported(version)
pylas.errors.FileVersionNotSupported: 1.0

location: <unknown location>:-1
INFO:root:INFO: path: C:\Users\[name]\Desktop\NUKE\projects\reel\CG_Integration\city_fire_cars\ele\2164253NE.las
INFO:root:INFO: Parse Point Data File: ...
WARNING:pylas.lasreader:There are 137 bytes between end of vlrs and start of points
Python: Traceback (most recent call last):
  File "C:\Users\[name]\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\photogrammetry_importer\operators\point_data_import_op.py", line 49, in execute
    points = PointDataFileHandler.parse_point_data_file(path, self)
  File "C:\Users\[name]\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\photogrammetry_importer\file_handlers\point_data_file_handler.py", line 238, in parse_point_data_file
    point_cloud = PyntCloud.from_file(ifp)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pyntcloud\core_class.py", line 130, in from_file
    return cls(**FROM_FILE[ext](filename, **kwargs))
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pyntcloud\io\las.py", line 90, in read_las
    data = read_las_with_pylas(filename)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pyntcloud\io\las.py", line 64, in read_las_with_pylas
    las = las_file.read()
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pylas\lasreader.py", line 92, in read
    evlrs = self.read_evlrs()
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pylas\lasreader.py", line 209, in read_evlrs
    return evlrs.EVLRList.read_from(self.stream, self.header.number_of_evlr)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pylas\evlrs.py", line 89, in read_from
    raw = RawEVLR.read_from(data_stream)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\site-packages\pylas\evlrs.py", line 42, in read_from
    raw_evlr.record_data = data_stream.read(
MemoryError

Joint Rendering of the GPU Shader Module and Viewport

Currently, this addon uses the GPU Shader Module, i.e.

import gpu
from gpu_extras.batch import batch_for_shader

to draw point clouds in the 3D Viewport.

Unfortunately, it is not possible to render this content using Blender's default OpengGL renderer. See this question for more information.

Therefore, I'm looking for an alternative way to jointly render point clouds and other Blender elements (such as cameras, image planes) with correct occlusion.

Drawing cameras and image planes with the GPU module is theoretically possible. However, I can imagine that there are cleaner approaches to solve this issue.

Add point cloud as mesh

Hi,
Thanks a lot for this addon ! I want to render a colored pointcloud(.ply) format in blender and I try to use "Representing the Points with a Mesh Object (using Blender’s Geometry Nodes)". I use the option Add Geometry Nodes. The ply file is imported as "Mesh Point Cloud" but there is no geometry node.

I also tes the[example ply file contained in this repository and it doesn't work too. Here are some logs:
image
image
image
image

Importing as Point Cloud object or Mesh with Vertex Color

Hi I tested the addon using Blender 2.92 so far so good. It also imports point data as Particle + instance + color.

The mesh import currently only import points data, however like Blender import PLY, it does not seem to carry the point color data? I wish this addon can import it as Custom Attribute data? Which can be somewhat used by Geometry Nodes Modifier maybe in near future?

Ideally of course to be able to import point data as a real Point Cloud object in Blender?

What do you think about mesh data + vertex color + instance with those colors? Instead of Particles?

Python KeyError

I am so sorry to trouble anyone, especially if I have done something wrong on my end.

I switched to using Meshroom 2023.1.0 from Meshroom 2021.1.0. I use the ConvertSfMFormat module in Meshroom to generate the SfM File Format to bring into Blender. I am getting error messages when trying to import SFM to Blender. I received the error when using Blender 3.2 with Photogrammetry Import Export Addon V 3.

I also received the error when I updated to Blender 3.5.1 and Photogrammetry Import Export Addon V 3.2.1.

The error reads as follows:

path: E:\2023 0427 Nikon Z9 Test Hyperlapse Chrysler Building\Meshroom\MeshroomCache\ConvertSfMFormat\d8a89f83c33daf9affe1274217752a01d4a7f35b\sfm.sfm
parse_meshroom_file: ...
meshroom_ifp: E:\2023 0427 Nikon Z9 Test Hyperlapse Chrysler Building\Meshroom\MeshroomCache\ConvertSfMFormat\d8a89f83c33daf9affe1274217752a01d4a7f35b\sfm.sfm
parse_meshroom_sfm_file: ...
sfm_ifp: E:\2023 0427 Nikon Z9 Test Hyperlapse Chrysler Building\Meshroom\MeshroomCache\ConvertSfMFormat\d8a89f83c33daf9affe1274217752a01d4a7f35b\sfm.sfm
Python: Traceback (most recent call last):
File "C:\Users\Admin\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\photogrammetry_importer\operators\meshroom_import_op.py", line 107, in execute
) = MeshroomFileHandler.parse_meshroom_file(
File "C:\Users\Admin\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\photogrammetry_importer\file_handlers\meshroom_file_handler.py", line 494, in parse_meshroom_file
cams, points = cls.parse_meshroom_sfm_file(
File "C:\Users\Admin\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\photogrammetry_importer\file_handlers\meshroom_file_handler.py", line 187, in parse_meshroom_sfm_file
) = cls._parse_cameras_from_json_data(
File "C:\Users\Admin\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\photogrammetry_importer\file_handlers\meshroom_file_handler.py", line 95, in _parse_cameras_from_json_data
focal_length = float(intrinsic_params["pxFocalLength"])
KeyError: 'pxFocalLength'

Error when "Add an Image Plate for each Camera" option is checked

First.. THANK YOU for sharing this. I'm very interested in getting this working as I find it will be very useful when it comes to cleaning up the photogrammetry results. I am new to coding with Blender, so excuse any misinterpretations of the data.

When I use the addon in order to import my NVM file, I receive an error. This seems to be occurring due to the code that is triggered by the import option to "Add an Image Plate for each Camera".

If I uncheck all the options except for the "Import Cameras" option, the script completes and has created cameras for each of my images (though the parent null seems to be rotated -90 degrees). From here I can manually create background images and they line up with the geometry I created (via COLMAP + MeshLab).

Selecting + copy & pasting the error here. Also attaching my NVM file zipped.
(Note: the order of the "Traceback..." and "location:..." lines are swapped from what is displayed. Copy/pasting flips it?)

Traceback (most recent call last):
  File "/home/jerbot/.config/blender/2.79/scripts/addons/nvm_import_export/import_nvm_op.py", line 519, in execute
    camera_scale=self.camera_extent)
  File "/home/jerbot/.config/blender/2.79/scripts/addons/nvm_import_export/import_nvm_op.py", line 294, in add_cameras
    op=op)
  File "/home/jerbot/.config/blender/2.79/scripts/addons/nvm_import_export/import_nvm_op.py", line 360, in add_camera_image_plane
    shader_node_diffuse_bsdf.inputs['Color'])
AttributeError: 'NoneType' object has no attribute 'inputs'

location: <unknown location>:-1

inuksuk.nvm.zip

Not an issue - but a request!

Hi,

Thank you for this amazing set of tools - really really handy!

I use Meshroom, which is all working brilliantly for me, and I particularly love the way the cameras import allows interpolation and animation of the actual camera points -

I also use Metashape from agisoft (will output from this be possible to import in the future?) , but for now, I can import the cameras and model using Alembic ex/import, but it does not create the keyframe animation - are you able to explain the process of animating between the fixed positions? - Thanks!

Importing files from WebODM failed

Hi,

I tried to import some files that were made in WebODM...
With the LAZ it worked, but it took very long time.
But I couldn't import any of the json-files, for example the "cameras.json"
I know that WebODM is based on OpenSFM, so I used that option.
Here is a link to a ZIP of all the files: https://testhub.dronedb.app/r/soeren68/42cjmkvjidqsbxaf
("all.zip" on top of the list)
Maybe you can analyze the files somehow and discover what's the problem with the WebODM output...

Greeting from Germany,
Sören

Enabling addon error

Hello !
Sorry to bother again, but when I try the latest verison of the addon I have what looks like a circular dependency whenever I enable the addon.

Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender 2.82\2.82\scripts\modules\addon_utils.py", line 351, in enable
mod = import(module_name)
File "C:\Users\Charles\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\photogrammetry_importer_init_.py", line 41, in
modules = developer_utils.setup_addon_modules(path, name, "bpy" in locals())
File "C:\Users\Charles\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\photogrammetry_importer\utils\developer_utils.py", line 39, in setup_addon_modules
modules = import_submodules(names)
File "C:\Users\Charles\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\photogrammetry_importer\utils\developer_utils.py", line 30, in import_submodules
modules.append(importlib.import_module("." + name, package_name))
File "C:\Program Files\Blender Foundation\Blender 2.82\2.82\python\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\Charles\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\photogrammetry_importer\utils\opengl_utils.py", line 7, in
from photogrammetry_importer.opengl.visualization_utils import DrawManager
File "C:\Users\Charles\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\photogrammetry_importer\opengl\visualization_utils.py", line 7, in
from photogrammetry_importer.utils.blender_point_utils import compute_particle_coord_texture
ImportError: cannot import name 'compute_particle_coord_texture' from 'photogrammetry_importer.utils.blender_point_utils' (C:\Users\Charles\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\photogrammetry_importer\utils\blender_point_utils.py)

I think the problem is that 'compute_particle_coord_texture' function might be needed in one of its dependencies, thus the error. I am sorry I cannot help more, I don't know the code of this addon.
I would like to help so maybe I will dive into it at some point.

Does it work on your setup ? Maybe blender 2.82 has some slight differences that cause python to look for the wrong modules ?

Thanks in advance !

Recursively starting Blender instances

Using blender 2.81a on MacOS.

Observed that the following code starts a new instance of Blender (preferences/dependency.py:Line:21):

    result = subprocess.run(
        [sys.executable, "-c", script_str],
        stdout=PIPE,
        stderr=PIPE,
    )

The intention seems to be to get the blender sys.path. Yet, instead of closing the instance it seems to call the same code again. This will recursively open new Blender instances.

For now I just changed Line:42:
additional_system_paths = get_additional_command_line_sys_path()
to
additional_system_paths = []

Render image with blender, view point error

Hi, I try to use blender to render a new image with colmap sfm result (I use a .obj model ), so I use this addon python interface to import colmap cameras into blender, then I render a image, but the image view is not the same as original image, any idea about this problem?
-------------BTW, I use following api to import and convert camera from colmap to blender
#first import all cameras from colmap folder
cameras, points3D = ColmapFileHandler.parse_colmap_model_folder(model_idp, image_idp, image_fp_type="NAME")

#then add a camera to blender
camera_object = add_camera_object(cam, cam_name, camera_collection)

then i render with .obj model, but the result image viewpoint is not correct compared with original image

Not loading mesh

Hi there! i've just dowloaded the addon and followed the youtube tutorial and i'm having some troubles to load the mesh along with the point cloud ¿any toughts or work around this?

Blender 2.91
Windows 64 bit 20H2

How to Import .PLY through this Addon on Python Script?

Hi, first of all, Thank you for developing this great addon.
Unfortunately, I'm new to Blender and Python, So please forgive me for asking basic question.
I'm making simple python script that running blender background and I want import ply file while using this addon.
So I've reading API Reference and I feel totally lost in here.

Is there any function kinda bpy.ops.import_scene.ply? and which module should I import?

Any recommendation or advice would be appreciated. Many thanks for reading.

Cannot import openmvg json camera

Hi ! First of all, thank you so much for this addon, it could help me a lot for with I'm trying to do !

So here's the problem: I used Regard3D (http://www.regard3d.org/) which is an awesome tool for photogrammetry. I found that it creates a sfm scene (sfm_data.bin)

I successfully converted this bin file into json thanks to openMVG usign these options (-V -I -E). So I get a json file with view ids, intrinsics and extrinsics. These should be enough for json import, though I ran into this weird error:

Traceback (most recent call last):
File "C:\Users\Charles\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\photogrammetry_importer\photogrammetry_import_op.py", line 180, in execute
path, self.image_dp, self.image_fp_type, self)
File "C:\Users\Charles\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\photogrammetry_importer\file_handler\openmvg_json_file_handler.py", line 169, in parse_openmvg_file
cams = OpenMVGJSONFileHandler.parse_cameras(json_data, image_dp, image_fp_type, op)
File "C:\Users\Charles\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\photogrammetry_importer\file_handler\openmvg_json_file_handler.py", line 50, in parse_cameras
polymorphic_name = intrinsics[int(id_intrinsic)]['value']['polymorphic_name']
KeyError: 'polymorphic_name'

Here is how the intrinsics look like after conversion:

"intrinsics": [
{
"key": 0,
"value": {
"polymorphic_id": 2147483649,
"polymorphic_name": "pinhole_radial_k3",
"ptr_wrapper": {
"id": 2147483745,
"data": {
"width": 4000,
"height": 6000,
"focal_length": 15193.06853136843,
"principal_point": [
2010.6631635894829,
3013.5288307892844
],
"disto_k3": [
0.23547542621624013,
1.0377324669468973,
25.664009974069687
]
}
}
}
},
{
"key": 1,
"value": {
"polymorphic_id": 1,
"ptr_wrapper": {
"id": 2147483746,
"data": {
"width": 6000,
"height": 4000,
"focal_length": 26837.64213005792,
"principal_point": [
3024.948789263701,
2005.5551594699007
],
"disto_k3": [
1.308115485771672,
23.88648384690404,
-560.0914521542329
]
}
}
}
},
{
"key": 2,
"value": {
"polymorphic_id": 1,
"ptr_wrapper": {
"id": 2147483747,
"data": {
"width": 6000,
"height": 4000,
"focal_length": 25512.9448045926,
"principal_point": [
3061.900325109015,
1997.2968905128087
],
"disto_k3": [
1.5001251036783452,
-26.644358754059213,
1921.1474880697998
]
}
}
}
},
{
"key": 3,
"value": {
"polymorphic_id": 1,
"ptr_wrapper": {
"id": 2147483748,
"data": {
"width": 4000,
"height": 6000,
"focal_length": 14108.98059220295,
"principal_point": [
2004.5743060023872,
3021.6981645876114
],
"disto_k3": [
0.136069949695253,
0.7672774745376262,
16.480312185674408
]
}
}
}
},
{
"key": 4,
"value": {
"polymorphic_id": 1,
"ptr_wrapper": {
"id": 2147483749,
"data": {
"width": 6000,
"height": 4000,
"focal_length": 14123.264459113307,
"principal_point": [
3046.6720924000785,
2035.155786688224
],
"disto_k3": [
0.03136966972788541,
7.1919426547408709,
-114.82146264426034
]
}
}
}
},
{
"key": 5,
"value": {
"polymorphic_id": 1,
"ptr_wrapper": {
"id": 2147483750,
"data": {
"width": 6000,
"height": 4000,
"focal_length": 17775.452419755573,
"principal_point": [
3034.855326792158,
2035.176286944217
],
"disto_k3": [
0.42808247529376267,
6.4239000531778649,
-58.24064251915535
]
}
}
}
}
]

Does anyone have an idea why the poylmorphic_name is not consistent throughout the intrinsics ?
This is untouched, from openMVG, and using only one dataset.

Thanks in advance :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.