Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 12
Posts: 12   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 11272 times and has 11 replies Next Thread
digitaltrails
Member
Member's Avatar

New Zealand
Joined: Dec 28, 2014
Post Count: 94
Status: Offline
Reply to this Post  Reply with Quote 
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,observerSizeType
Overview,13527.723,8459.4375,5482.206,42.0,-359.0,63.0,2018-05-04T12:00+12:00[Pacific/Auckland],PINHOLE,observer,variableSize
Fence,19926.076,9641.014,2976.5076,31.0,-315.0,63.0,2018-06-21T15:30:00.242+12:00[Pacific/Auckland],PINHOLE,topview,variableSize

Names 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:
  • PINHOLE - Default
  • NORMAL - Depth of field
  • FISHEYE - Fisheye
  • SPHERICAL - Spherical
The viewType can be observer (virtual visitor) or topview (aerialview).

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/
[Apr 3, 2019, 9:33:35 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
digitaltrails
Member
Member's Avatar

New Zealand
Joined: Dec 28, 2014
Post Count: 94
Status: Offline
Reply to this Post  Reply with Quote 
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.
[Apr 3, 2019, 10:32:40 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
digitaltrails
Member
Member's Avatar

New Zealand
Joined: Dec 28, 2014
Post Count: 94
Status: Offline
Reply to this Post  Reply with Quote 
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.
[Apr 8, 2019, 5:08:58 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
treehousenorris2
Newbie



United States
Joined: Sep 14, 2020
Post Count: 15
Status: Offline
Reply to this Post  Reply with Quote 
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?
[Sep 23, 2020, 8:25:33 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
digitaltrails
Member
Member's Avatar

New Zealand
Joined: Dec 28, 2014
Post Count: 94
Status: Offline
Reply to this Post  Reply with Quote 
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:24
Archive: /home/michael/eteks/sweethome3d/plugins/CameraBagPlugin-1.0.jar
Zip file size: 16198 bytes, number of entries: 13
-rw---- 2.0 fat 25 bX defN 19-Apr-03 17:56 META-INF/MANIFEST.MF
-rw---- 2.0 fat 732 bl defN 19-Apr-02 13:46 com/eteks/digitaltrailscamerabag/CameraBagPlugin.class
-rw---- 2.0 fat 1171 bl defN 19-Apr-02 13:45 com/eteks/digitaltrailscamerabag/CameraBagPlugin.java
-rw---- 2.0 fat 7232 bl defN 19-Apr-03 17:55 com/eteks/digitaltrailscamerabag/CameraImportAction.class
-rw---- 2.0 fat 5855 bl defN 19-Apr-03 17:55 com/eteks/digitaltrailscamerabag/CameraImportAction.java
-rw---- 2.0 fat 6890 bl defN 19-Apr-03 17:55 com/eteks/digitaltrailscamerabag/CameraExportAction.class
-rw---- 2.0 fat 4887 bl defN 19-Apr-03 17:55 com/eteks/digitaltrailscamerabag/CameraExportAction.java
-rw---- 2.0 fat 1163 bl defN 19-Apr-02 13:48 com/eteks/digitaltrailscamerabag/Local.class
-rw---- 2.0 fat 1364 bl defN 19-Apr-02 13:48 com/eteks/digitaltrailscamerabag/Local.java
-rw---- 2.0 fat 718 bl defN 19-Apr-02 15:03 com/eteks/digitaltrailscamerabag/ApplicationPlugin.properties
-rw---- 2.0 fat 6 bl defN 15-Oct-09 09:11 .gitignore
-rw---- 2.0 fat 478 bl defN 15-Sep-30 19:55 .classpath
-rw---- 2.0 fat 401 bl defN 19-Apr-02 13:22 .project


Hope that helps.

Cheers,
Michael
[Sep 23, 2020, 10:13:13 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
harbinger
Member
Member's Avatar

US
Joined: Feb 27, 2014
Post Count: 87
Status: Offline
Reply to this Post  Reply with Quote 
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?
[Sep 23, 2020, 11:54:45 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
digitaltrails
Member
Member's Avatar

New Zealand
Joined: Dec 28, 2014
Post Count: 94
Status: Offline
Reply to this Post  Reply with Quote 
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,observerSizeType
Overview0800,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T08:00:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize


I 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,observerSizeType
Overview0800,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T08:00:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview0830,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T08:30:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview0900,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T09:00:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview0930,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T09:30:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1000,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T10:00:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1030,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T10:30:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1100,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T11:00:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1130,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T11:30:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1200,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T12:00:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1230,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T12:30:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1300,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T13:00:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1330,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T13:30:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1400,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T14:00:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1430,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T14:30:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1500,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T15:00:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1530,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T15:30:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1600,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T16:00:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize
Overview1630,15858.19,-5870.0215,23499.879,59.0,1.0,63.0,2018-06-21T16:30:00.186+12:00[Pacific/Auckland],PINHOLE,topview,variableSize


I 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.
[Sep 24, 2020, 1:25:08 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
treehousenorris2
Newbie



United States
Joined: Sep 14, 2020
Post Count: 15
Status: Offline
Reply to this Post  Reply with Quote 
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."
[Sep 24, 2020, 3:30:32 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
jkli
Newbie



USA
Joined: Oct 27, 2021
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
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? :)
[Oct 27, 2021, 4:36:19 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
digitaltrails
Member
Member's Avatar

New Zealand
Joined: Dec 28, 2014
Post Count: 94
Status: Offline
Reply to this Post  Reply with Quote 
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.
[Oct 28, 2021, 4:37:07 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 12   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved