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.


Messages - LDBL

Pages: [1]
1
Python and Java API / Re: Crop to GCPs in Sparse Cloud
« on: May 14, 2019, 07:22:04 PM »
Hello Alexey,

Hello Leon,

Which task you are trying to solve with the script?

I have excess data that needs to be disposed of. An example is in the attached image. The red cross hatch area within the GCPs is what I'd like to keep, and get rid of all of the blank space surrounding. I have a large batch of data sets to do this to, so if I can achieve this through python scripting, it will save a lot of time.


Quote
And what problem do you have with CUDA/OpenCL in the latest version? In Metashape you can switch between CUDA/OpenCL implementation for NVIDIA graphic cards with the tweak main/gpu_enable_cuda
.

I run Linux and I'm using an AMD RX 570, I've found that it is faster using 1.4.5 than 1.5.x, I'm on older AMDGPU-Pro (OpenCL only) drivers too as the latest slow down processing (OpenCL 2+), and ROCm wasn't recognised by Photoscan/Metashape..but that could have been my fault due to installation error. I haven't tested since 1.5.0/1 as this is working very well for me. I haven't convereted my python script from PhotoScan to Metashape either, because this current set up is working well (I will do at some point, I'm just time constrained at the moment).

Cheers,

Leon

EDIT: I should probably add that all of my data sets have been manually prepared by doing an initial sparse build and meshing so that GCPs can be added, so the crop to selection is available in the model tab of the GUI.

2
Python and Java API / Crop to GCPs in Sparse Cloud
« on: May 13, 2019, 11:42:48 PM »
Hello,

Agisoft 1.4.5 (still using the older version due to python script and OpenCL)

I've been trying to incorporate this into a larger script;

https://www.agisoft.com/forum/index.php?topic=8985.0

Unfortunately, it doesn't seem to crop to the markers I'm using?

Code: [Select]
## load project

import PhotoScan
doc = PhotoScan.app.document
doc.open('XX.psz')
chunk = doc.chunk

## select GCPs

for marker in chunk.markers:
    if marker.label == 'B1':
        marker.reference.enabled = True
        break
for marker in chunk.markers:
    if marker.label == 'B2':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B3':
        marker.reference.enabled = True
        break
for marker in chunk.markers:
    if marker.label == 'B4':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B5':
        marker.reference.enabled = True
        break
for marker in chunk.markers:
    if marker.label == 'B7':
        marker.reference.enabled = True
        break
for marker in chunk.markers:
    if marker.label == 'B8':
        marker.reference.enabled = True
        break
for marker in chunk.markers:
    if marker.label == 'B9':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B10':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B11':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B12':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B13':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B14':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B15':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B16':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B18':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B19':
        marker.reference.enabled = False
        break
for marker in chunk.markers:
    if marker.label == 'B20':
        marker.reference.enabled = False
        break

## rebuild sparse with selected GCPs

chunk.point_cloud = None
chunk.matchPhotos(accuracy=PhotoScan.LowAccuracy, generic_preselection=True, reference_preselection=True, keypoint_limit=40000, tiepoint_limit=4000)
for camera in chunk.cameras:
    camera.transform = None
chunk.alignCameras(adaptive_fitting = False)
doc.save('XX.psz')

## crop

import PhotoScan

chunk = PhotoScan.app.document.chunk
T = chunk.transform.matrix
crs = chunk.crs
if not chunk.shapes:
chunk.shapes = PhotoScan.Shapes()
chunk.shapes.crs = chunk.crs

shape = chunk.shapes.addShape()
shape.label = "boundary"
shape.type = PhotoScan.Shape.Polygon
shape.boundary_type = PhotoScan.Shape.BoundaryType.OuterBoundary

coords = [crs.project(T.mulp(marker.position)) for marker in chunk.markers]
shape.vertices = [PhotoScan.Vector([coord.x, coord.y]) for coord in coords]

Is there something missing, has something changed?

Thanks in advance.

Leon

3
Python and Java API / Re: Resize bounding box
« on: February 13, 2019, 03:04:21 PM »
So I've found an answer in this thread;

https://www.agisoft.com/forum/index.php?topic=8679.0

By modifying this line;

Code: [Select]
new_size = PhotoScan.Vector([2.5*side2g.norm()/s, 2.5*side1g.norm()/s, 1.5*side1g.norm()/s]) ##
This has the desired effect of being able to create a bounding box of the necessary dimensions for the Monte Carlo to run successfully.

4
Python and Java API / Resize bounding box
« on: February 11, 2019, 12:35:46 AM »
Hello,

I've incorporated the code from here;

https://www.agisoft.com/forum/index.php?topic=7543.0

In to a script I'm putting together, that also utilises the MC32 script found here;

https://www.lancaster.ac.uk/staff/jamesm/software/sfm_georef.htm

I'm trying to automate the process of ensuring the bounding box is larger than the point cloud for the Monte Carlo analysis to run successfully (both python scripts runs flawlessly within Photoscan/Metashape) but when I'm running the analysis through SfM_Georef, anywhere between 50-90% of the Monte Carlo iterations are rejected due to the bounding box being too small.

Is there a way to say, add 20% or 20m in the X,Y, and Z of the box within this?;

Code: [Select]
import PhotoScan, math

doc = PhotoScan.app.document
chunk = doc.chunk
region = chunk.region
T = chunk.transform.matrix

m = PhotoScan.Vector([10E+10, 10E+10, 10E+10])
M = -m

for point in chunk.point_cloud.points:
if not point.valid:
continue
coord = T * point.coord
coord.size = 3
coord = chunk.crs.project(coord)
for i in range(3):
m[i] = min(m[i], coord[i])
M[i] = max(M[i], coord[i])

center = (M + m) / 2
size = M - m

region.center = T.inv().mulp(chunk.crs.unproject(center))
region.size = size * (1 / T.scale())

v_t = T * PhotoScan.Vector( [0,0,0,1] )
v_t.size = 3
R = chunk.crs.localframe(v_t) * T
region.rot = R.rotation().t()

chunk.region = region
print("Script finished.")

Report to moderator   Logged

Cheers,

Leon

5
Bug Reports / Re: Relink ./libgfortran.so.3' with `/usr/lib/librt.so.1'
« on: February 11, 2019, 12:08:15 AM »
OK, cool. Thanks Alexey.

6
Bug Reports / Relink ./libgfortran.so.3' with `/usr/lib/librt.so.1'
« on: January 31, 2019, 12:46:39 AM »
Hello,

I've just upgraded my system (Linux) and that's included moving from an Ubuntu 18.04 to Manajaro (Arch).

When I run metashape from the CLi, I'm getting a relink notification (I think the system uses a newer version of GCC along with libgfortran.so.4);

Code: [Select]
Relink `/home/leond/ThirdParty/metashape-pro_1_5_0_amd64/metashape-pro/./libgfortran.so.3' with `/usr/lib/librt.so.1' for IFUNC symbol `clock_gettime'
Is this something that can be ignored? Or will it cause problems further down the line?

Cheers,

Leon

7
General / Re: Being booted into demo mode whilst using a floating licence
« on: January 17, 2019, 11:26:05 PM »
Unfortunately, Yes. But it's not supposed to...

8
Python and Java API / Re: split_in_chunks: Zero Resolution Error (v1.5)
« on: January 17, 2019, 09:49:40 PM »
In order to skip "zero resolution" chunks for the dense cloud generation, you can use try-except approach:


Code: [Select]
try:
   chunk.buildDenseCloud()
except Exception as exc:
    print("Something wrong for chunk ", chunk.label, ". Skipped error: ",exc)

Thanks Alexey, will try this.

9
General / Re: Being booted into demo mode whilst using a floating licence
« on: January 17, 2019, 09:47:29 PM »
Hi Alexey,

I've issued a help request to the server administrator, so just awaiting a reply from him.

Yes, starts in fully functional mode but then reverts to demo (even when connected to the university VPN...which is required to just use the floating licence).

There doesn't appear to be a time frame associated either, for example, it's not regular, like an hourly check, just appears to be random.

I can reconnect, but my workflow has been interrupted by that point (either by a save point or a non demo function).

Cheers,

Leon

10
General / Being booted into demo mode whilst using a floating licence
« on: January 17, 2019, 09:29:54 PM »
Hello,


I'm using a floating licence via my university, I have the option to borrow the licence so that I need not be constantly connected via the VPN.

Recently, I've experienced Photoscan (v 1.4.2 and 1.4.5) and Metashape, both booting back to demo mode (so no save option and halting my python scripting workflow) even though I've borrowed a licence for 30 days. This is regardless of whether I'm still attached to the VPN or not.

I'm running PS or Metashape on an Ubuntu 18.04 distro.

Is this a PS/Metashape issue or a university issue?

Cheers,

Leon

11
Python and Java API / Re: split_in_chunks: Zero Resolution Error (v1.5)
« on: January 17, 2019, 09:22:42 PM »
Apologies for jumping on your thread but I've experienced the same with a different line of code.

Although not entirely the same, I also received zero resolution in v1.5 when python scripting hit

Code: [Select]
chunk.alignCameras()
As above, python script works in previous versions. Also changing python script from
Code: [Select]
PhotoScan. to
Code: [Select]
Metashape. has no bearing on success or failure of script to run...just seems to hit a wall and zero resolution.

12
Python and Java API / Re: reset_alignment
« on: January 08, 2019, 10:01:46 PM »
That's fixed it.

Legend, thank you!

13
Python and Java API / Re: reset_alignment
« on: January 08, 2019, 12:37:13 PM »
OK, so I've amended the code and tried running it and I'm still not getting a rebuild in the same way as with the GUI.

Is there something else I'm missing?!

Code is;

Code: [Select]
import PhotoScan
doc = PhotoScan.app.document
doc.open('/mnt/w/Coverack_PP/C1/C1_base_MA_TPA.psz')
chunk = doc.chunk
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, generic_preselection=True, reference_preselection=False, keypoint_limit=40000, tiepoint_limit=4000)
for camera in chunk.cameras:
    camera.transform = None
doc.save('/mnt/w/Coverack_PP/C1/C1_40k_4k.psz')

Cheers,

Leon

14
Python and Java API / Re: reset_alignment
« on: January 08, 2019, 12:29:42 PM »
Hi Alexey,

Thanks for your quick reply, and apologies for my slow response.

To confirm, I'm using 1.4.3.

Will try the amended script now.

Cheers,

Leon

15
Python and Java API / reset_alignment
« on: December 22, 2018, 01:49:51 AM »
Hello collective,

I'm trying to emulate the "reset current alignment" option in the GUI.

Essentially, I have a 'base' model I need to rebuild multiple times with different setting via python, but to do so, I need to be able to reset the current alignment each time.

My code thus far is;

Code: [Select]
import PhotoScan
doc = PhotoScan.app.document
doc.open('XXX.psz')
chunk = doc.chunk
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, generic_preselection=True, reference_preselection=False, keypoint_limit=40000, tiepoint_limit=4000)
chunk.alignCameras(reset_alignment=True)
doc.save('XXX.psz')

But this fails. Selecting to reset alignment in the GUI works fine.

Any help please?

Thanks,

Leon

Pages: [1]