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 - Thibaud Capra

Pages: 1 [2] 3 4 ... 7
16
Feature Requests / Re: Show progress in taskbar
« on: April 28, 2017, 03:52:28 PM »
+1 !
Very convenient when multitasking indeed.

17
Feature Requests / Re: (Masking) - Ignore mask feature
« on: April 28, 2017, 03:51:40 PM »
That would be great, using the epipolar lines from a point, if it crosses a mask, to ignore the point.
On the other hand, masks are used to remove unwanted things in photos, and might sometimes be used to mask things on certains photos, but not for permanent removal (ie. a car passing by).

Then it'd be a optional thing I guess?

18
For the record, I printed the values of my variables:

Code: [Select]
    box_x = chunk.region.size.x
    box_y = chunk.region.size.y
    box_z = chunk.region.size.z

And they're all around 1 or 0.8...

19
Python and Java API / Process chunk depending on bounding box's size
« on: April 26, 2017, 03:41:27 PM »
Hello everyone

I'm currently working on UAV-based models where I process subparts of a global point cloud. Problem is, if the bounding box is too small, I may have issues processing it (DPC, Meshing etc.) because my photo coverage is insufficient.

Since the scene's coverage is constant (one photo every X meters), I determined the minimal surface for the bounding box to have enough photos in it to process things properly : 500 m².

I figured my condition would be something like
(I also loosen the region size until the bounding box is big enough):

Code: [Select]
for chunk in doc.chunks
    region = chunk.region
    box_x = chunk.region.size.x
    box_y = chunk.region.size.y
    box_z = chunk.region.size.z
    Box_surf = box_x * box_y
    while Box_surf < 500: #m²
        region.size = 1.1 * region.size
        chunk.region = region
        box_x = chunk.region.size.x
        box_y = chunk.region.size.y
        box_z = chunk.region.size.z
        Box_surf = box_x * box_y
    # Densify
    # Mesh etc.

How can I get the size in meters?
Any way to make it cleaner?

Thanks in advance.

20
Hello Alexey,

Can I remove layers based on their labels? If so, how?
I'm using keywords in the labels to determine where to export the file. (The same way I use keywords in chunk labels to process different LODs in one batch)

21
Hello Alexey,

The problem is, I have shapes in multiple chunks, would this work in a for loop doing roughly this:

Code: [Select]
for chunk in doc.chunks:
    Delete all layers but one based on layer labels
    Export layer
    Reopen project
    Export next layer the same way
    Loop through chunks

Additional difficulty (but I found a way around for this one), it musn't loop through all the chunks but only those with some specific keyword in the chunk label.
Wouldn't closing the project reset the progress in the various chunks?

I'm aware of the fact that this is a very specific question, but my aim is to automatize as much of the processing as possible!

22
Hello Alexey,

Too bad, I'll see if I change the rest of the scripts I wrote to adapt it to 1.3.x to allow me to export automatically all my shapes, or stick to what I have for now and export my shapes the old-fashioned way, aka manually!

As usual, thanks for the great support!

23
Hello Alexey,

I think this layer grouping is too recent, as I have the following error now:

     chunk.exportShapes(path, groups = layer)
 TypeError: 'groups' is an invalid keyword argument for this function


Or is it some error in my code?

Code: [Select]
import os, PhotoScan

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

path = "C:\\PFE_CAPRA\\Essais_Shapes\\Shapes"
for chunk in doc.chunks:   
    for layer in chunk.shapes.groups:
        chunk.exportShapes(path, groups = layer)

24
Hello Alexey,

Code: [Select]
for layer in chunk.shapes.layers:
      chunk.exportShapes(path, groups = layer)

I think this layer export method works in 1.3.x, I am currently using PhotoScan 1.2.6 Build 2834... I have the following error message:

Traceback (most recent call last):
File "C:\PFE_CAPRA\Essais_Shapes\Script_Shapes.py", line 18, in <module>
for layer in chunk.shapes.layers:
AttributeError: 'PhotoScan.Shapes' object has no attribute 'layers'



25
Hello Alexey,

I don't get the shape group creation part.
Are groups the corresponding layers by default? Or do I have to assign them first to each different ShapeGroup key? If need be, how do I do that?
For example, I made a small test project with two layers I want to export (see below) as two different shape files.

For now, I have the following code:

Code: [Select]
import os, PhotoScan

doc = PhotoScan.app.document
chunk = doc.chunk
shapes = chunk.shapes
source = shapes.crs
out = PhotoScan.CoordinateSystem("EPSG::3948")
type_chunk = ['Green']

for chunk in doc.chunks:
    if not any(type_chunk[0] in chunk.label for type_chunk in type_chunk):
        for shape in chunk.shapes:
            shape.vertices = [PhotoScan.CoordinateSystem.transform(v, source, out) for v in shape.vertices]
        shapes.crs = out
    print("""Les SHP de """ + chunk.label + """ ont été transformées avec succès !""")

for chunk in doc.chunks:   
    for shape in chunk.shapes:
        if not any(type_chunk[0] in chunk.label for type_chunk in type_chunk):
            chunk.exportShapes(path = "C:\\PFE_CAPRA\\Essais_Shapes\\Green.shp", groups = ShapeGroup(key = 1))
            chunk.exportShapes(path = "C:\\PFE_CAPRA\\Essais_Shapes\\Approche.shp", groups = ShapeGroup(key = 2))

Thanks

26
Hello Alexey,

Thanks for your precious help, as usual!

I'm also trying to export my shapes, using chunk.exportShapes as you recommended. My question is, if I have multiple shape layers, will it create one shape file per layer or one merged shape file?

I'd like to keep my shapes separated according to the shape layers, using maybe the shape layer's name to identify them. Is it possible?

27
I guess I should use something the like of:

Code: [Select]
PhotoScan.Shapes.crs.transform(EPSG::4326, EPSG::3948)
PhotoScan.Shapes.crs.update

Then I'd export my shapes, right?

28
Hello Alexey,

I'm kind of bumping this topic because I haven't figured out how to do it.

A simple piece of code exporting the shape from whatever his coordinate system is (here I believe it's WGS84) into L93/CC48 would do... Could you help me once again ?

29
+1! That'd be really useful, mostly to remove small noise manually.

30
Hello Alexey,

After running a few tests with my script on smaller samples as you advised, I fixed the code. The fact that I was saving two different projects while processing messed up the whole thing!

Thanks for the support, as always.

Pages: 1 [2] 3 4 ... 7