Forum

Author Topic: Relation between chunk coordinate system and region coordinate system  (Read 8166 times)

smihic

  • Newbie
  • *
  • Posts: 31
    • View Profile
Hi,
   could somebody explain the relation between coordinate system of chunk and region coordinate system and how to interact with each other.

Thank you in advance.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Relation between chunk coordinate system and region coordinate system
« Reply #1 on: March 04, 2015, 03:48:39 PM »
Hello smihic,

If you are going to convert coordinates of the vector v1 from internal coordinate system to geographic, you need to perform the following operations:
Code: [Select]
v1_new = chunk.transform.matrix.mulp(v1) #now it is vector in geocentric coordinates
v1_new = chunk.crs.project(v1_new) #vector in geographic coordinates

to convert from geographic coordinates to the internal coordinate system you need to perform the inverse operation:
Code: [Select]
v2_new = chunk.crs.unproject(v2) #now in geocentric coordinates
v2_new = chunk.transform.matrix.inv().mulp(v2_new)
Best regards,
Alexey Pasumansky,
Agisoft LLC

smihic

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Relation between chunk coordinate system and region coordinate system
« Reply #2 on: March 04, 2015, 05:53:45 PM »
Hi Alexey,
  thank you, but I don't have geographic coordinate system, so I can't use you solution. I will try to rephrase my question are internal coordinate system of the chunk, and coordinate system of bounding box (region) related somehow?

I ask this because I tried to set minimal bounding box around the subject, by calculating minimum and maximum points the subject occupies (using sparse point cloud) and I don't get expected results (bounding box is shifted)




Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Relation between chunk coordinate system and region coordinate system
« Reply #3 on: March 04, 2015, 05:57:14 PM »
Center of the bounding box (chunk.region.center) is in internal coordinate system, like chunk.cameras[0].center or chunk.markers[0].position.

But is the chunk referenced or not?
Best regards,
Alexey Pasumansky,
Agisoft LLC

smihic

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Relation between chunk coordinate system and region coordinate system
« Reply #4 on: March 04, 2015, 06:26:23 PM »
No, chunk is not referenced, does this make any difference?

So is there a relation between chunk coordinate system and coordinate system of bounding box?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Relation between chunk coordinate system and region coordinate system
« Reply #5 on: March 04, 2015, 07:48:43 PM »
Hello smihic,

Bounding box is in the internal coordinate system, so when you get the coordinates of the points in the cloud - they are in the same system.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Seb_B

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Relation between chunk coordinate system and region coordinate system
« Reply #6 on: March 28, 2015, 06:28:21 PM »
On the other hand, chunk.size is in the chunk coodinate system and not in "internal coordinate system"! This confusing!  ;)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Relation between chunk coordinate system and region coordinate system
« Reply #7 on: March 29, 2015, 02:43:55 AM »
Hello Sebastian,

chunk.region.size and chunk.region.center are in the same units, actually.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Seb_B

  • Newbie
  • *
  • Posts: 38
    • View Profile
Hello Alexey,

I am confused! I do project with makers that I give "local coordonates" (eg: x=1m, y=0.5m, z=1m). These coordinates are geographic coordinates or geocentric coordinate?
I want a region.size of V_s= (5m,5m,20m)
How I convert my vector V_s in internal coordinate to resize my region?

Following your last comment in this post I should do this:
V_s= T.inv().mulp(PhotoScan.Vector([5, 5,22])
new_reg = chunk.region
new_reg.size = V_s
chunk.region = new_reg
Does it right? If yes, I don't get the desired size of my bounding box!

If I do this:
V_s=chunk.crs.unproject(PhotoScan.Vector([5,5,20]))
V_s= T.inv().mulp(V_s)
I have an error message: " AttributeError: 'NoneType' object has no attribute 'unproject'  "

If I do this:
V_s= PhotoScan.Vector([5, 5,22])
new_reg = chunk.region
new_reg.size = V_s
chunk.region = new_reg
The bounding box is alright in some project but not in all! What I am doing wrong???



Seb_B

  • Newbie
  • *
  • Posts: 38
    • View Profile
Sorry my T=chunk.transform.matrix