|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: CameraBagPlugin Export/Import Points of View as CSV |
||
| Print at Dec 15, 2025, 7:03:36 PM |
|
|
| Posted by digitaltrails at Apr 3, 2019, 9:33:35 PM |
|
CameraBagPlugin Export/Import Points of View as CSV I've written a plugin that can export and import a model's named points of view (its cameras) to a CSV file (hence camera bag, a bag of cameras). The plugin adds Export Cameras and Import Cameras menu items to the tools menu. When invoked via the menu, the plugin pops up an appropriate file selection dialog, defaulting to cameras.csv. The ability to export/import provides you some ability to work around the current 50 points of view limit set in SH3D. Plus it provides you with the ability to generate points of view in bulk. For example, say I need to create 30 images from the same point of view over a 3 month period. Rather than pointing and clicking to create 30 points of view, I can just export a single point of view and them use a spreadsheet or column oriented editor to generate the 29 other points of view, and then import all 30 back into SH3D. The exported CSV looks something like: #name,x,y,z,pitch,yaw,fov,time,cameraType,viewType,observerSizeTypeNames with commas in them will be exported with the commas replaced by spaces. The date will be exported in the time zone of the model's compass. Yaw, pitch, and fov angles are in degrees. For the moment x, y, z are internal metric only. The cameraTypes are internal names that correspond to the Lens setting in the create photo panel as follows:
The observerSizeType is internal and determines some of the format of tooltips in some circumstances, it would normally be variableSize for both observer and topview cameras, but if the cameraType is observer, it may be fixedSize (perhaps just copy what's been exported). The plugin has been uploaded to the sourceforge SH3D plugins contrib: https://sourceforge.net/p/sweethome3d/plug-ins/25/ |
| Posted by digitaltrails at Apr 3, 2019, 10:32:40 PM |
|
Re: CameraBagPlugin Export/Import Points of View as CSV I put up a new version of this plugin to deal with a bug that got into the release where exports with the variableSize column couldn't be imported. It also highlighted the need for some additional error messages which I will deal with later. |
| Posted by digitaltrails at Apr 8, 2019, 5:08:58 AM |
|
CameraBagPlugin v1.5 now allows more than 50 cameras I've uploaded version 1.5 to sourceforge: https://sourceforge.net/p/sweethome3d/plug-ins/25/ (and scroll to the bottom) In version 1.5 I added error checking and reporting on unparsable times, numbers, and the wrong number of fields. I also added the ability to have more than 50 cameras. SH3D normally limits the number of cameras to 50. If more than 50 cameras are imported, the importer will pop up a dialog and ask if the limit should be ignored. The other choice is that the importer enforces the limit and truncates the import. If you subsequently ask SH3D to store a location, it will truncate the list back to 50 and you will then have to reimport to restore any in excess of the limit. I added the limit override because I need to do several timelapse sequences to analyse sunlight and shading over autumn, winter and spring. It's a bit easier if I don't have to break it down into 50 images at a time. |
| Posted by treehousenorris2 at Sep 23, 2020, 8:25:33 PM |
|
Re: CameraBagPlugin v1.5 now allows more than 50 cameras Thank you for this plugin, works great! I'm making a (shortcut) plugin to export the cameras to a sandbox directory, and would like to access the method without using the save dialog box. Can you post the source code? |
| Posted by digitaltrails at Sep 23, 2020, 10:13:13 PM |
|
Re: CameraBagPlugin v1.5 now allows more than 50 cameras Thank you for this plugin, works great! I'm making a (shortcut) plugin to export the cameras to a sandbox directory, and would like to access the method without using the save dialog box. Can you post the source code? Thanks, it's nice to get some feedback. The Java source code and project files are included in the plugin zip file: zipinfo ~/eteks/sweethome3d/plugins/CameraBagPlugin-1.0.jar  ✔  10001  08:58:24Hope that helps. Cheers, Michael |
| Posted by harbinger at Sep 23, 2020, 11:54:45 PM |
|
Re: CameraBagPlugin v1.5 now allows more than 50 cameras I don't understand... What can I use the plug-in for? Can you give an example of what I can do with it? |
| Posted by digitaltrails at Sep 24, 2020, 1:25:08 AM |
|
Re: CameraBagPlugin v1.5 now allows more than 50 cameras I don't understand... What can I use the plug-in for? Can you give an example of what I can do with it? No worries. I'll describe one example. I have a site where the SH3D model is correctly located and oriented according to the map/GPS coordinates. I wanted to look at how shading at a site would change during a winter's day. To do this I needed to generate sequences of images from the same point of view but for different times of the day. To do this I used the plugin to export and import the camera positions. I exported the following camera position: #name,x,y,z,pitch,yaw,fov,time,cameraType,viewType,observerSizeTypeI then edited the exported CSV and duplicated the position multiple times, but each time I advanced the time by 30 minutes: #name,x,y,z,pitch,yaw,fov,time,cameraType,viewType,observerSizeTypeI imported all these new camera positions and had SH3D generate images for all of them (which I could also optionally recombine into a video). The above could have been achieved by manually creating each camera position inside SH3D, but I wanted to do months worth of such images. To create large numbers of camera positions it is easier to use some external tool (such as a spreadsheet or shell-script). Additionally I needed more points than the SH3D user interface would normally allow. Plus I wanted to be able to use the same sequences in different SH3D models created for the same site. In general the plugin might be useful if you want to externally generate and manage large numbers of camera positions, or would like some way to externally store and restore more than the 50 permitted by the SH3D user interface. |
| Posted by treehousenorris2 at Sep 24, 2020, 3:30:32 PM |
|
Re: CameraBagPlugin v1.5 now allows more than 50 cameras Yes that helps! The .sh3p extension is a renamed .jar file. A jar file's contents can be extracted with `jar xf myPlugin.jar` to be viewed in a file explorer. Or a jar file's contents can be viewed in a terminal with `zipinfo myPlugin.jar`. Or a jar file's contents can be viewed in Eclipse via "Once downloaded, drag and drop the file SweetHome3D-6.4.2.jar on the MyPlugin project icon in the Package Explorer view of Eclipse, and choose the item Build Path > Add to Build Path in the contextual menu of SweetHome3D-6.4.2.jar file, as shown in figure 2." |
| Posted by jkli at Oct 27, 2021, 4:36:19 PM |
|
Re: CameraBagPlugin Export/Import Points of View as CSV Hi, i noticed the x,y,z coordinates aren't in the designated units (i.e. ft and inches), but instead perhaps per pixel. I'm trying to take pictures of each floor of a high rise building from the same camera distance to the floor elevation but can't seem to find the right scaling. Is there a particular scale to unit designation? Any help please? :) |
| Posted by digitaltrails at Oct 28, 2021, 4:37:07 AM |
|
Re: CameraBagPlugin Export/Import Points of View as CSV Hi, i noticed the x,y,z coordinates aren't in the designated units (i.e. ft and inches), but instead perhaps per pixel. I'm trying to take pictures of each floor of a high rise building from the same camera distance to the floor elevation but can't seem to find the right scaling. Is there a particular scale to unit designation? Any help please? :) It's been a while, so I cannot recall much about the units. I was primarily concerned with changing time not place, so distance units don't loom large in my memory. You could save the csv for two elevations by changing the height of the virtual visitor, work out difference, and convert that to the units per metre. Hopefully the units would be consistent. |
|
|
|
Current timezone is GMT Dec 15, 2025, 7:03:36 PM |