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

Pages: [1] 2
1
Python and Java API / Render image from set locations.
« on: September 10, 2018, 07:04:54 PM »
I'm looking for a way to render thumbnails of a mesh from 4 set locations.
The 3d Meshes will have +Z facing up so would like to have 4 locations (1,0,0), (-1,0,0), (0,1,0), (0,-1,0) all with the cameras facing 0,0,0

Any idea on the matrix math to snap a camera to these locations and facing?
Also is there a way to set the resolution of the render or is it fixed to the sensor size of one of the camera?

Thanks.

2
Python and Java API / Re: Limiting Poly count
« on: July 27, 2018, 12:40:58 AM »
One last question, I'm having some difficulty on getting the dense cloud count.

I found in the API doc there is a "point_count" parm in the "class PhotoScan.DenseCloud" but I keep getting errors that there is no attribute "DenseCloud"

3
Python and Java API / Re: Limiting Poly count
« on: July 26, 2018, 07:00:05 PM »
Thanks, that sounds like it will work.  :)

4
Python and Java API / Re: Limiting Poly count
« on: July 26, 2018, 05:57:20 PM »
So here's what I'm getting:
If I use this call
Code: [Select]
chunk.buildModel(surface=PhotoScan.Arbitrary, interpolation=PhotoScan.EnabledInterpolation, face_count=12000000)
I get a 12M poly mesh with these prints:
2018-07-24 17:31:37 38780994 faces extracted in 203.899s
2018-07-24 17:32:46 decimating mesh (38755449 -> 12000000)
2018-07-24 17:32:46 Decimating mesh...

and with this call
Code: [Select]
chunk.buildModel(surface=PhotoScan.Arbitrary, interpolation=PhotoScan.EnabledInterpolation, face_count= PhotoScan.HighFaceCount)
I get a 2.6M poly mesh with these prints:
2018-07-26 10:36:07 38781010 faces extracted in 201.784s
2018-07-26 10:37:16 decimating mesh (38755457 -> 2677401)
2018-07-26 10:37:16 Decimating mesh...

So the full mesh is above 12M so what you said is true but why is the "High" setting so much lower?
In the cases I'm trying to limit the "High" setting will give me a mesh over 12M so I'm trying to cap it but in cases like this where the "high" setting is going to be below 12M I want to use it instead of forcing to 12M.

Is that possible? at the moment I am constructing at high and then checking the "mesh_face_count" and if it is above 12M I decimate it back down but would like to skip the extra processing time this takes.

Thanks

5
Python and Java API / Re: Limiting Poly count
« on: July 24, 2018, 10:59:03 PM »
So I tried this and don't seem to be getting the result you suggested.

I'm now calling:
Code: [Select]
chunk.buildModel(surface=PhotoScan.Arbitrary, interpolation=PhotoScan.EnabledInterpolation, face_count=12000000)
and after running a test mesh it is generated at 12M polys. If I go to the menu and pick build mesh and set the "Face count" to "High" the menu shows it will built at 1,179,108 polys.

From the API doc it says the function take a var or int
- face_count (PhotoScan.FaceCount or int) – Target face count.
and the var's are:
class PhotoScan.FaceCount
Face count in [LowFaceCount, MediumFaceCount, HighFaceCount]

So it looks like it is always building to 12M polys this way.

Is there a different way to call this to get the functionality you mentioned?

6
Python and Java API / Re: Render image constrained to bounding box
« on: July 20, 2018, 07:04:22 PM »
Bump, still looking for a solution for this, taking all suggestions :)

7
Python and Java API / Limiting Poly count
« on: July 20, 2018, 07:01:48 PM »
I was wondering if there is a way though python to set a may poly count when constructing the mesh.
I want to set a high cap level so the poly count can go up to that but not over, also not forcing the mesh to be always that high which I think what happens if I use the custom setting.

I'm using this call currently:
Code: [Select]
chunk.buildModel(surface=PhotoScan.Arbitrary, interpolation=PhotoScan.EnabledInterpolation, face_count=PhotoScan.HighFaceCount)

8
Python and Java API / Re: Render image constrained to bounding box
« on: June 14, 2018, 10:40:41 PM »
Anyone have any ideas on a solution to my issue?
Are there any python commands that cam change the orientation of the mesh's pivot without moving the mesh?

9
Python and Java API / Re: Render image constrained to bounding box
« on: June 05, 2018, 09:31:15 PM »
*Bump*
Any idea's on how to resolve this issue?
It's so close to working, just needs the rotations fixed.

10
Python and Java API / Re: Render image constrained to bounding box
« on: May 18, 2018, 06:53:50 PM »
To be more specific it seems when getting the initial point
Code: [Select]
point = chunk.region.center + PhotoScan.Vector([0,0, chunk.region.size.z * 2])Even though the location is being pulled from the regions location it seems it's pivot orientation is coming from the mesh.
If I translate the region around the render image changes accordingly, but rotating the region has no effect.

So when adding the vector "0,0,chunk.region.size.z * 2" it is moving the camera away from the mesh along what looks like +X in relative to the pivot of the mesh and not the region. So if I could reset the mesh's pivot or have the vector addition be relative to the region's pivot then I could place the render location to where I need it to be.

11
Python and Java API / Re: Render image constrained to bounding box
« on: May 16, 2018, 10:24:25 PM »
I have the model aligned to be facing down +X using markers so if the camera was at 2,0,0 world space and facing down -X it should be looking at the front of the model.

Using the script you supplies seemed to work and the location is based off the region but it seems when adding the PhotoScan.Vector([0,0, chunk.region.size.z * 2]) it is pushing the point away from the center of the region relative to the models pivot and not the world pivot.

I attached a image on the top image you can see the blue camera is where I expect it to end up using the script. The red camera is where it actually ends up.
In the bottom image I have reset the object transform so I could pick the "Rotate Object" mode and used the "Align pivot to bounding box" script to move the mesh back to world 0 for easy viewing, but in Rotate object mode you can see the pivot of the mesh lines up with where the camera is, I tried this with a different file and found the same results. So it seems it's using the mesh's pivot to determine the vector.

So my option are set a location in world space as the meshes will always be at the origin and facing +X or reset the pivot of the mesh, then the script you provided will work.

Thanks :)

12
Python and Java API / Re: Render image constrained to bounding box
« on: May 16, 2018, 09:03:32 PM »
So I think I found the problem, It seems the problem is local pivot of the mesh.
So this script is pushing the camera position back along the X axix but that is not always aligned with the front of the model.

Is there a way in script to reset the meshs pivot to align it to the world without effecting the mesh?

13
Python and Java API / Re: Render image constrained to bounding box
« on: May 16, 2018, 12:41:09 AM »
Actually a bigger issue is I'm getting random directions the images are generated from.
I added prints to see the locations and they are similar between renders but almost 180 around the mesh
This is the script section I'm using:
Code: [Select]
point = chunk.region.center + PhotoScan.Vector([0,0, chunk.region.size.z * 2])
print ('chunk center ' + str(chunk.region.center))
print ('Point ' + str(point))

T = PhotoScan.Matrix([[1,0,0, point.x], [0,-1,0, point.y], [0,0,-1, point.z], [0,0,0,1]])

image = chunk.model.renderImage(T, chunk.sensors[0].calibration)
image.save(fileName)

For file 1 the image is rendered looking at the front of the model and I get these values
  • chunk center Vector([-0.26232785948007087, 0.3646970820972305, -4.446110936333984])
  • Point Vector([-0.26232785948007087, 0.3646970820972305, -1.8394649697945527])

and for the 2nd file the image is rendered from behind and the left, about 130 Deg around clockwise with these values

  • chunk center Vector([-0.08863683743844113, 1.0348724772492839, -3.6829016954626757])
  • Point Vector([-0.08863683743844113, 1.0348724772492839, -2.1615090949770757])

All the camera are in the same location as they are statically mounted and both meshes have been aligned using markers so they are in the same world space.

any thoughts as whats going on?

14
Python and Java API / Re: Render image constrained to bounding box
« on: May 15, 2018, 11:58:41 PM »
One other thing, Is there a way to change the rendering background colour?

15
Python and Java API / Re: Render image constrained to bounding box
« on: April 25, 2018, 10:29:43 PM »
Awesome !!!!
this does exactly that I needed. Now just fiddling with the parm's for different cam locations

Thanks :)

Pages: [1] 2