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

Pages: 1 [2] 3 4
16
Thanks Alexey - great suggestions; all working nicely now.

n.b. for anyone wanting to do something similar, the code to retrieve the original bounding box center (again thanks to Alexey for providing this) is:

Code: [Select]
old_center = chunk.crs.project(chunk.transform.matrix.mulp(reg.center))
Jeremy

17
Thanks Alexey - worked great!

Seems as though the issue is that for some models, the estimated ground level differs from the 'real world' ground level, which should always be centered on 0 (these are aerial images and the exif altitude is set as the height above the ground).  This is probably due to poor image quality / overlap leading to large errors in model height estimation (?).

Is there a way of generalising this process, i.e. obtaining the correct center (which in this case was 14m) for the bounding box from the sparse cloud / original region center, which can then be used when adjusting the bounding box x and y extents?  Ideally I'd like to automate the entire procedure.

Thanks again

18
Hi Alexey,

Any more ideas on this?  I've tried a few variations but can't get the bounding box to align properly in the z-direction.  Interestingly, this only happens occasionally with the models - the code I linked above works fine for 95% of the models I run.

Thanks

19
Hi Alexey,

Thanks for the quick reply.  The reason I'm not currently setting those variables is that I do not know them explicitly beforehand (I do know the x-y center and extent, but want to leave the z dimensions the same).  What would you suggest setting the z values of the center_geo and geo_size variables?

I did try setting the z-dimension values to reasonable numbers but got the same result (bounding box below the model) - any ideas?

Thanks again for your help

20
Hi,

I am using a python script to reset my model bounding box x and y locations and dimensions, as well as its z-rotation, while keeping the bounding box z extent and center the same.  The x and y shift, scaling and rotation work well, but the bounding box seems to change its z-location relative to the model (even though a console output of the box center z value is the same before and after the transformation).

For clarity, I have attached screenshots before and after applying the transformation, showing the unwanted shift in z-location of the bounding box (which transfers the bounding box away from the model, making further processing fail); you can also see the console which shows the region center values before and after the transformation, showing the z value remains the same.

My code is below:

Code: [Select]
import PhotoScan
import math

bbox_center = [-119.43639088933767, 36.57570587655139]  # deg - wgs84
bbox_size = [193.71339323337548, 99.76327818514577]  # m
bbox_rot =  180.58462719482992  # deg

doc = PhotoScan.app.document
chunk = doc.chunk
reg = chunk.region
trans = chunk.transform.matrix

print("region center: {}".format(reg.center))
print("region size: {}".format(reg.size))
print("region rot: {}".format(reg.rot))

newregion = PhotoScan.Region()
center_geo = PhotoScan.Vector([bbox_center[0], bbox_center[1], 0.])  # uses existing region height

v_temp = chunk.crs.unproject(center_geo)
v_temp.size = 4
v_temp.w = 1
centerLocal = chunk.transform.matrix.inv() * v_temp
centerLocal.size = 3
newregion.center = PhotoScan.Vector([centerLocal[0], centerLocal[1], reg.center[2]])  # uses existing region height
print("newregion center: {}".format(newregion.center))

# Set region size:
# generate scale factor
rot_untransformed = PhotoScan.Matrix().diag([1, 1, 1, 1])
rot_temp = trans * rot_untransformed
s = math.sqrt(rot_temp[0, 0] ** 2 + rot_temp[0, 1] ** 2 + rot_temp[0, 2] ** 2)

# scale desired size in metres to chunk internal coordinate system
inter_size = PhotoScan.Vector([0, 0, 0])
geo_size = PhotoScan.Vector([bbox_size[0], bbox_size[1], 0])  # uses original chunk region z size

inter_size = geo_size / s
newregion.size = PhotoScan.Vector([inter_size[0], inter_size[1], reg.size[2]])
print("newregion size: {}".format(newregion.size))

# Set region rotation
# build z-axis rotation matrix
SinRotZ = math.sin(math.radians(bbox_rot))
CosRotZ = math.cos(math.radians(bbox_rot))
RotMat = PhotoScan.Matrix([[CosRotZ, -SinRotZ, 0, 0], [SinRotZ, CosRotZ, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])

#  rotate region bounding box
v = PhotoScan.Vector([0, 0, 0, 1])
v_t = trans * v
v_t.size = 3
m = chunk.crs.localframe(v_t)
m = m * trans
m = RotMat*m
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()
print("newregion rot: {}".format(newregion.rot))

# put newregion to chunk
chunk.region = newregion

Any ideas what I'm doing wrong and how to fix are greatly appreciated.

Thanks

21
General / Re: aerial images placed beneath model after alignment
« on: March 23, 2015, 10:53:18 PM »
Hi Alexey,

Thanks for the quick replay as always.  Yup, I thought similar, but get the same result when repeating alignment with pair selection disabled - I guess it's disregarding the gps locations (as they're so inaccurate), and guessing an alignment direction.  If this does occur, is there a way of flipping the model (ideally through the console) so the ortho scales correctly?

Jeremy

22
General / aerial images placed beneath model after alignment
« on: March 23, 2015, 10:18:01 PM »
I have a set of georeferenced drone images (https://www.dropbox.com/s/0om9ixa32z94mv0/images.zip?dl=0) that stitch together nicely, however when aligned, they place the dense cloud (and model etc.) location above the images rather than below:

https://www.dropbox.com/s/g0wnl68xorhyzf4/Screenshot%202015-03-23%2012.05.34.png?dl=0

which leads to the georeferenced orthophoto having the wrong scale and not aligning properly with satellite imagery after export.

Is there a way I can force photoscan to always have the images pointing downwards, or flip the dense cloud / model if it appears above them?

Thanks

23
General / Re: failure to align images from fisheye lens camera
« on: March 14, 2015, 12:08:17 AM »
oh, interesting - would you recommend that as a default then?

24
General / Re: failure to align images from fisheye lens camera
« on: March 13, 2015, 11:58:12 PM »
Yup, that seemed to work for me - thanks.  The big thing was switching to allow a minimum of 0 tie points - is the downside to this that more noise can be introduced?  Also how did you judge which images to remove to get rid of all the extra noise (I imagine it's a lot of experience, but would be great to be able to automate as much of this process as possible... )?

Thanks again

25
General / Re: failure to align images from fisheye lens camera
« on: March 13, 2015, 11:21:00 PM »
Thanks for the quick replay as per usual Alexey!

So there's too much overlap in this case?  I've noted quite a large inaccuracy in the gps info embedded in the exif - would you suggest using generic preselection instead?

What settings did you use to get the images to stitch after removing the extra photos you mentioned?

Thanks again for your help

26
General / failure to align images from fisheye lens camera
« on: March 13, 2015, 10:12:54 PM »
I'm failing on the align step for this (https://www.dropbox.com/s/0om9ixa32z94mv0/images.zip?dl=0) set of images from a fisheye lens camera (from a DJI phantom).  I'm using high-quality align, fisheye camera type and the latest photoscan version (1.1.3).  This is weird, as I've had success with similar image sets, and there's clearly enough overlap with the images.

Any suggestions very much appreciated,

Thanks

27
General / Re: recommended value for reprojection error limit
« on: February 04, 2015, 12:34:09 AM »
Thanks for the reply - very helpful!  Strange why removing points with reprojection_error > 1  is cutting out so much of my model then (cutting the points out ends up producing large gaps in my dense cloud... ).

Thanks for the tip on lens calibration - do you normally find that one extra align seeded with the adjusted calibration parameters does the trick, or do you keep iterating (and if so, which parameter are you trying to minimise?)?  Weird side issue I'm having with this step: I can save the adjusted calibration params as an xml from the gui just fine, but when I try to load them back in to the initial values, I get an error message with "could not load parameters" - is this the same procedure you use, or am I doing something wrong?

Thanks again for your help - it's really appreciated

28
General / recommended value for reprojection error limit
« on: February 03, 2015, 10:11:04 PM »
I would like to remove all points with high reprojection error after the align stage to improve my model quality - any recommendations for a sensible limit I should use?

I had been using a limit of 1.0 in photoscan 1.0.4, however in 1.1.0 this value now seems to be too aggressive (cutting out most of my data), so I was wondering if there is a specific value which indicates very inaccurate data that I could use for all my models?

Thanks

29
Python and Java API / Re: project not saving properly
« on: January 24, 2015, 11:55:28 PM »
Great, thanks Alexey - that fixed it.

30
Python and Java API / Re: project not saving properly
« on: January 24, 2015, 01:31:50 AM »
Hi Alexey,

Thanks for the fast reply - the change worked nicely!  Interestingly it failed when I used : "doc = PhotoScan.app.document", but worked with "doc = PhotoScan.Document()".

Now it seems to be working, but two other bugs have cropped up:
 - no texture is created / exported for the model
 - no texture is saved in the project file

Any ideas?

Thanks again for your help

Pages: 1 [2] 3 4