Forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - SB

Pages: [1]
1
Python and Java API / save / load list of selected cameras
« on: April 27, 2018, 05:03:24 PM »
Hello,

I frequently have to reset alignment for  groups of cameras when I have a project with more than 5000 photos. 

I group the cameras in camera groups and choose cameras from several groups to help with realignment.  Sometimes I would like to change the area of focus but it means that I have to select a new set of cameras from the groups to work on the new area.  When I am ready to go back to the previous area of focus, I have to find the same group of cameras that I was using before.

I would really like a python script that will save the selected cameras into a file that I can reload later. 

The file can be just a plain text file with camera names or camera ids.  Doesn't matter.

When the file is loaded, the script would read each line of the file and select the camera if it exists. 

Can someone help me with this?  I'm using Photoscan 1.4 Professional.

Thank you!

SB

2
General / Cannot align chunks in network mode
« on: October 23, 2015, 07:29:19 PM »

Hello

I have PhotoScan Pro and use it to align 3000 photos in 6 chunks with 6 network nodes.

Now I am trying to align the chunks over the network but it the network monitor only shows failure count incrementing very fast.  The netowrk node console on each node shows

thread started
processing job: AlignChunks
opened project in 0 sec
loading chunk: xxxx filename xxxx
thread deleted

In network mode it takes a few hours to align the photos in some chunks but will take 1 week to align the chunks in this manner on one workstation.

Is it possible to align chunks using multiple nodes?

Thank you very much,
SB


3
General / How I copy markers from chunk to chunk
« on: September 30, 2015, 08:59:27 PM »
Hello

I'm working on a project that has 5 chunks.  The front of the building is divided into 2 chunks with 1000 photos each.  To make chunk alignment easier, all 5 chunks have some duplicate photos.

I set the markers on all the photos in one chunk and needed to copy the same marker positions onto the duplicate photos in the ohter chunks.  Import markers is no good as it clears all marker data that is not in the imprted xml file.

I found examples of how to import markers in the "General" forum and had to make some changes.  This script will let you import a marker export file (xml) exported from one chunk into another chunk.  If the marker exists already, any cameras in the import file are added/modified and all other cameras with that marker are unchanged.

If the marker does not exist, one is created and all the camera positions are imported from the xml file for that marker.

The main thing that the examples do NOT do is preserve the "pinned" status.  This script will import the x,y coordinates and the "pinned" status is preserved if it is set to True.  If an imported marker camera has the "pinned" status set to "True", it is also set to True when imported into the new chunk.  If it is not set to True, then it is left as the default.


Here is the modified script





import PhotoScan
from xml.dom import minidom

path = PhotoScan.app.getOpenFileName("Specify input XML file:")

doc = PhotoScan.app.document
chunk = doc.chunk

xml = minidom.parse(path)
main = xml.childNodes[0]

xml_markers_reference = xml.childNodes[0].childNodes[1].childNodes[5]
xml_markers_proj = xml.childNodes[0].childNodes[1].childNodes[7].childNodes[1].childNodes[1]
xml_camera = xml.childNodes[0].childNodes[1].childNodes[3]

cameras = dict()
markers = dict()
marker_proj = dict()
marker_proj_pins = dict()

for i in range(1, len(xml_camera.childNodes) - 1, 2):
   
   camera_id = xml_camera.childNodes.getAttribute("id")
   camera_label = xml_camera.childNodes.getAttribute("label")
   cameras[camera_label] = camera_id
   
for i in range(1, len(xml_markers_reference.childNodes) - 1, 2):
   
   marker_id = xml_markers_reference.childNodes.getAttribute("id")
   marker_label = xml_markers_reference.childNodes.getAttribute("label")
   markers[marker_id] = marker_label

for i in range(1, len(xml_markers_proj.childNodes) - 1, 2):

   cam_list = dict()
   pinned_list = dict()
   marker_id = xml_markers_proj.childNodes.getAttribute("marker_id")
   
   for j in range(1, len(xml_markers_proj.childNodes.childNodes) - 1, 2):

      camera_id = xml_markers_proj.childNodes.childNodes[j].getAttribute("camera_id")
      x = float(xml_markers_proj.childNodes.childNodes[j].getAttribute("x"))
      y = float(xml_markers_proj.childNodes.childNodes[j].getAttribute("y"))
      pinned = xml_markers_proj.childNodes.childNodes[j].getAttribute("pinned")
      
      cam_list[camera_id] = PhotoScan.Vector([x, y])
      pinned_list[camera_id] = pinned.lower() in ("yes", "true", "1")
       

   marker_proj[marker_id] = cam_list
   
   marker_proj_pins[marker_id] = pinned_list
   

   
for marker_id in marker_proj.keys():

        dup_found = False
        for mrkr in chunk.markers:
                if mrkr.label == markers[marker_id]:
                        m = mrkr
                        print ("Duplicate Marker found " + mrkr.label + " - using it")
                        dup_found = True
       
        if not dup_found:
                chunk.addMarker()
                m = chunk.markers[-1]
                m.label = markers[marker_id]

        for camera in chunk.cameras:
                if camera.label in cameras.keys():
                        if cameras[camera.label] in marker_proj[marker_id].keys():
                                print ("Adding camera " + camera.label + " to marker " + m.label )
                                m.projections[camera] = marker_proj[marker_id][cameras[camera.label]]
                                if marker_proj_pins[marker_id][cameras[camera.label]] :
                                        print ("Setting pin to True")
                                        m.projections[camera].pinned = marker_proj_pins[marker_id][cameras[camera.label]]

print("Script finished")




4
General / Anybody use general selection to clean up sparse points?
« on: September 10, 2015, 05:14:40 AM »
Hello

I've been looking at a lot of Python scripts and NONE of them try to clean up the point clouds before generating a mesh.  Am I the only person who uses gradual selection to remove uncertain points?

I try to reduce reprojection error to 1.0 - 1.2 and remove uncertain points at a level of 400 for every chunk before generating the dense clouds.

Am I doing the correct procedure??

Thank you

5
General / how to use markers to set gps and size?
« on: July 09, 2015, 08:06:25 PM »
Hello

I have PhotoScan Pro and I'm trying to scale a model with mesh and texture to the right size.

The model consists of several buildings and some ground between them with different elevations.  I used 2206 cameras (mostly TIFF images with gps EXIF) and some jpg images taken from 4k video (without EXIF). 

The model looks great - dense cloud is wonderful with 61M points.  The mesh looks great with 90M faces.  After 3 weeks of processing (aligning, generating dense cloud) I took a good gps unit with waypoint averaging to the site and took 6 samples of several locations.  Then I placed 15 markers in the model and set the flags in most of the 2000+ cameras.

I have created 10 scale bars using the markers and set the distance in meters.  I also set the GPS lat, long, and alt for 3 of the markers.

The EXIF information in the TIFF images came from a DJI Inspire and contains gps information in WGS.  I also set the marker GPS information manually using WGS coordinates.  I clicked 'update'. 

No matter how many times I click 'update' and/or 'convert' , when I save the model as a obj or ply using 'Local Coordinants', the resulting saved model appears in GeoMagic and Meshlab as being 19mmx51mmx48mm in size. 

Even worse, if I save the model as 'WGS-84' coordinates, the resulting model is only a straight vertical line of a few points that doesn't even appear in my textured model anywhere.


I cannot figure out how to save the model in a way that MeshLab or GeoMagic knows about the correct scale.

The reason I care about having the saved model be the right size is because I'm trying to merge the fantastic Photoscan model I created with point cloud data captured from a laser scanner.  The laser scanner is very accurate and I want to get my Photoscan model the correct size using my gps coordinates and measured markers so it fits together with the laser scanned data.

Can someone help me out with this?

Thank you very much!!

SB


Pages: [1]