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 - viktork

Pages: [1]
1
Python and Java API / Re: Matrix Diag in new version of Agisoft
« on: February 06, 2017, 08:34:12 PM »
Hello Alexey,

I have delete the lines as you told me,worked fine but now i have a problem is not loading the whole photos because some stages are missing.
I believe that i made a big progress on that.
Tomorrow i will have a new module and i will try again.

Thanks for your help,
Viktor

2
Python and Java API / Re: Matrix Diag in new version of Agisoft
« on: February 06, 2017, 06:32:53 PM »
mp0 = 0
   mpy = 0
   mpx = 0
   fp0 = 0
   fpy = 0
   fpx = 0
   #setting for Y up, Z forward -> needed for mixamo/unity
   vector0 = PhotoScan.Vector((0,0,0))
   vectorY = PhotoScan.Vector((0,0,distancepy))   # Specify Y Distance
   vectorX = PhotoScan.Vector((distancepx,0,0))   # Specify X Distance
   c1 = 0
   c2 = 0
   c3 = 0
   c4 = 0
   c = 0

   for m in chunk.markers:
      if m.label == c1target:
         log ("Center 1 point found")
         c1 = c
      if m.label == c2target:
         log ("Center 2 point found")
         c2 = c
      if m.label == c3target:
         log ("Center 3 point found")
         c3 = c
      if m.label == c4target:
         log ("Center 4 point found")
         c4 = c
      if m.label == p0:
         mp0 = c
         fp0 = 1
         m.reference.location = vector0
         m.reference.enabled = 1
         log ("Found floormat center point")
      if m.label == py:
         mpy = c
         fpy = 1
         m.reference.location = vectorY
         m.reference.enabled = 1
         log ("found floormat Y point")
      if m.label == px:
         mpx = c
         fpx = 1
         m.reference.location = vectorX
         m.reference.enabled = 1
         log ("found floormat X point")
      c = c + 1 
 
   if fp0 and fpx and fpy:
      log ("Found all markers")
      chunk.updateTransform()
   else:
      log ("Error: not all markers found")

   newregion = chunk.region

   T = chunk.transform.matrix
   v_t = T * PhotoScan.Vector( [0,0,0,1] )
   m = PhotoScan.Matrix.Diag([1,1,1,1])   

   m = m * T
   s = math.sqrt(m[0,0] ** 2 + m[0,1] ** 2 + m[0,2] ** 2) #scale factor
   R = PhotoScan.Matrix( [[m[0,0],m[0,1],m[0,2]], [m[1,0],m[1,1],m[1,2]], [m[2,0],m[2,1],m[2,2]]])
   R = R * (1. / s)
   newregion.rot = R.t()

    # Calculate center point of the bounding box, by taking the average of 2 left and 2 right markers
   mx = (chunk.markers[c1].position + chunk.markers[c2].position + chunk.markers[c3].position + chunk.markers[c4].position) / 4

   mx = PhotoScan.Vector([mx[0], mx[1], mx[2]])
   newregion.center = mx

   dist = chunk.markers[mp0].position - chunk.markers[mpy].position
   dist = dist.norm()

   ratio = dist / distancepy

   newregion.size = PhotoScan.Vector([boxwidth* ratio, boxheight* ratio, boxdepth * ratio])

   chunk.region = newregion
   chunk.updateTransform()

   log("Bounding box should be aligned now")

3
Python and Java API / Re: Matrix Diag in new version of Agisoft
« on: February 06, 2017, 06:23:41 PM »
This is the lines that is going to do is in the stage that i trying to crate the bounding box:

   v_t = T * PhotoScan.Vector( [0,0,0,1] )
   m = PhotoScan.Matrix().diag([1,1,1,1])   

   m = m * T
   s = math.sqrt(m[0,0] ** 2 + m[0,1] ** 2 + m[0,2] ** 2) #scale factor
   R = PhotoScan.Matrix( [[m[0,0],m[0,1],m[0,2]], [m[1,0],m[1,1],m[1,2]], [m[2,0],m[2,1],m[2,2]]])
   R = R * (1. / s)
   newregion.rot = R.t()

    # Calculate center point of the bounding box, by taking the average of 2 left and 2 right markers
   mx = (chunk.markers[c1].position + chunk.markers[c2].position + chunk.markers[c3].position + chunk.markers[c4].position) / 4  >>>>> In this level is failing

   mx = PhotoScan.Vector([mx[0], mx[1], mx[2]])
   newregion.center = mx

   dist = chunk.markers[mp0].position - chunk.markers[mpy].position
   dist = dist.norm()

   ratio = dist / distancepy

   newregion.size = PhotoScan.Vector([boxwidth* ratio, boxheight* ratio, boxdepth * ratio])

   chunk.region = newregion
   chunk.updateTransform()

   log("Bounding box should be aligned now")

Thanks in advance for your help.

4
Python and Java API / Re: Matrix Diag in new version of Agisoft
« on: February 06, 2017, 06:15:58 PM »
Hello Alexey,

Thank you very much.
No is giving me another error.

Traceback (most recent call last):
File "C:/Users/Administrator/Desktop/Script/AutoProcess_v8-PIM.py", line 294, in <module>
 processscan(f)
 File "C:/Users/Administrator/Desktop/Script/AutoProcess_v8-PIM.py", line 216, in processscan
  mx = (chunk.markers[c1].position + chunk.markers[c2].position + chunk.markers[c3].position + chunk.markers[c4].position) / 4
 AttributeError: invalid arguments

Could you please give me a help?

Thanks for everything :)

5
Python and Java API / Matrix Diag in new version of Agisoft
« on: February 06, 2017, 05:39:06 PM »
Hello All,

I ma new in photoscan and i am trying a way to use the auto python script to create a model but when i try the script is failing in the stage

   m = PhotoScan.Matrix().diag([1,1,1,1])   

   m = m * T
   s = math.sqrt(m[0,0] ** 2 + m[0,1] ** 2 + m[0,2] ** 2) #scale factor
   R = PhotoScan.Matrix( [[m[0,0],m[0,1],m[0,2]], [m[1,0],m[1,1],m[1,2]], [m[2,0],m[2,1],m[2,2]]])

and gives an error AttributeError: 'PhotoScan.Document' object has no attribute 'diag'

Could you please someone give me a help why is doing that?

Thanks in advance,


Pages: [1]