Forum

Author Topic: Split pointcloud/mesh in equal parts  (Read 13012 times)

excalibur

  • Newbie
  • *
  • Posts: 14
    • View Profile
Split pointcloud/mesh in equal parts
« on: April 24, 2015, 10:10:16 AM »
Hi!

I am new to this forum and new to Agisoft :)

I have a question if it is possible (with Python script) to divide/split pointcloud or mesh in equal parts.

For example:

I have one chunk that has N photos that cover (in real life) area of one square kilometer. And now I would like to split this area in 10 equal parts (areas of 100m by 100m). For me it doesn't matter if I split generated pointcloud or generated mesh. But in the end I would like to have 10 equal parts for further post-processing in other software. But it need to be done inside of Agisoft. I know how to achieve this result by hand in Geomagic for example, but this is not what I am looking for.

So is it even possible in any way (or something with similar results) inside of Agisoft using Python API?

Thank your for any advice or suggestion.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #1 on: April 24, 2015, 01:24:18 PM »
Hello excalibur,

Probably you can use the following script as a template:
http://wiki.agisoft.com/wiki/Split_in_chunks.py

Note that in the current state it should be applied to the Referenced chunks.
Best regards,
Alexey Pasumansky,
Agisoft LLC

excalibur

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #2 on: April 24, 2015, 01:59:18 PM »
Since I am a noobie... what exactly does it mean referenced Chunk

I tried to run this script and i get an error:

Script started
Traceback (most recent call last):
  File "C:/*****/*****/*****/script.py", line 80, in <lambda>
    proc_split = lambda : self.splitChunks()
  File "C:/*****/*****/*****/script.py", line 159, in splitChunks
    doc.addChunk(new_chunk)
TypeError: addChunk() takes no arguments (1 given)
>>>

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #3 on: April 24, 2015, 02:03:42 PM »
Hello excalibur,

Referenced chunks have [R] sign next to their label in the Workspace pane.

Please also specify which version of PhotoScan you are using?
Best regards,
Alexey Pasumansky,
Agisoft LLC

excalibur

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #4 on: April 24, 2015, 02:08:28 PM »
Ok, my chunk has label [R].

I am using Photoscan 1.1.0

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #5 on: April 24, 2015, 02:11:13 PM »
Hello excalibur,

I suggest to update to the version 1.1.5.
Best regards,
Alexey Pasumansky,
Agisoft LLC

excalibur

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #6 on: April 24, 2015, 02:17:57 PM »
I have just updated - running 1.1.5 and still the same result  :(

Should I change something in code or should it work as "copy - paste" ?

Error appears after i press Split button


« Last Edit: April 24, 2015, 02:25:01 PM by excalibur »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #7 on: April 24, 2015, 02:29:48 PM »
Hello excalibur,

Just to copy and paste.

Are you sure you haven't modified anything? On line 80 there should be splitChunks() and not splitChunk()
Best regards,
Alexey Pasumansky,
Agisoft LLC

excalibur

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #8 on: April 24, 2015, 02:32:45 PM »
I tried once again.

1. Open one project
2. Align photos
3. run script (copy paste from your link)
4. clicked on Split

Error

Script started
Traceback (most recent call last):
  File "C:/Users/Marko/Desktop/script.py", line 80, in <lambda>
    proc_split = lambda : self.splitChunks()
  File "C:/Users/Marko/Desktop/script.py", line 159, in splitChunks
    doc.addChunk(new_chunk)
TypeError: addChunk() takes no arguments (1 given)
>>>

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #9 on: April 24, 2015, 03:08:14 PM »
Hello excalibur,

So it's 1.1.5?

Actually there shouldn't be such message in the latest release - just checked the same workflow as yours on the random dataset.
Best regards,
Alexey Pasumansky,
Agisoft LLC

excalibur

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #10 on: April 24, 2015, 03:09:21 PM »
yes it is 1.1.5.

i have updated Photoscan when you sad to update it...

confused right now  :D

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #11 on: April 24, 2015, 03:13:37 PM »
Ad if you type the following line to the Console pane, what would be the output?

Code: [Select]
PhotoScan.app.version
c = PhotoScan.Chunk()
PhotoScan.app.document.addChunk(c)

Best regards,
Alexey Pasumansky,
Agisoft LLC

excalibur

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #12 on: April 24, 2015, 03:28:40 PM »
>>> PhotoScan.app.version
c = PhotoScan.Chunk()
PhotoScan.app.document.addChunk(c)

  File "<console>", line 1
    PhotoScan.app.version
c = PhotoScan.Chunk()
PhotoScan.app.document.addChunk(c)
                       
   ^
SyntaxError: invalid character in identifier

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #13 on: April 24, 2015, 03:34:08 PM »
Lines should be input one by one.

First, enter, second, enter and etc.
Best regards,
Alexey Pasumansky,
Agisoft LLC

excalibur

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Split pointcloud/mesh in equal parts
« Reply #14 on: April 24, 2015, 03:42:24 PM »
after every press of "enter" nothing happens  :o after all 3 lines nothing happens. if i press enter one more time I get same error.  :o