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.


Topics - CindyFr

Pages: [1]
1
Python and Java API / Use of pickPoint() in order to create marker
« on: June 08, 2018, 03:23:27 PM »
Hello,

I want to pick points on my model.
I know the coordinates of points, when I place them by addMarker() function, they are at the right place, but if I reference my model, they leave I don't know where. I supposed that is because they are not really on the model but just beside. The idea is to get the point on the model. So I've found the pickPoint() function.
But when I try to use it, my point doesn't appear at the right place at all (It is not even on the model ...)

Can somebody help me please ?
I know the coordinate of my point because I pick it in another software.
v2 is the ray origin (here the coordinate of the camera when I pick point in my other software)
v3 is my point

Code: [Select]
v2 = PhotoScan.Vector([float(tabResetSrcO[idM][0]), float(tabResetSrcO[idM][1]), float(tabResetSrcO[idM][2])])
v3 = PhotoScan.Vector([float(srcP[0]), float(srcP[1]), float(srcP[2])])
p = chunk.model.pickPoint(v2,v3)
if(not(p is None)):
m = chunk.addMarker()
m.label = myOwnLabel
m.reference.location = p

2
Python and Java API / Input our own markers and theirs coordinates
« on: June 07, 2018, 05:52:00 PM »
Hello,

I want to create my own markers by scpriting. So, I already have my model, I export it and I pick point by another program, and then, I want to return into PhotoScan to create markers with my coordinates (in local system).

When I do that, my markers are not at the good place, and I'm wondering why.

Can somebody help me please ?
Thank you :)

My code : (I've simplied some names, so they are now explicit)
Code: [Select]
app = PhotoScan.Application()
doc = app.document
os.chdir(pathProject)
doc.open(projectName)
chunk = doc.chunk
v = PhotoScan.Vector([myPoint[0], myPoint[1], myPoint[2]])
m = chunk.addMarker(v, visibility = True)
m.Reference.projection = v

3
General / Export model not in local coordinates
« on: November 28, 2017, 04:17:06 PM »
Hi All,

I want to export my model in PLY and not in local coordinates but in WGS83. The problem is that my model can't be loaded by Meshlab or other viewer i used to deal with.

I've read that it can be due to the number of significant digit in the model, but when I export the model I can choose to uncheck binary encoding and choose the number of precision : this number seems to be the number of significant digit to write the model. I've also read that Meshlab can't display model with more than 3 significant digits, so I've put this precision to 3 (I've tried with 1, 3, 5 ...) and my model cannot be loaded one more time ...

Do you know how can I get my model with good coordinates out of Photoscan ?

Cindy.

4
Hello there !

I'm wondering what does Photoscan when we import new marker coordinates and when they don't exactly match :
- does he approximate the position of the model by meaning positions ?
- does he deform the model in order to exactly match coordinates ?

Thanks for your help !


5
Python and Java API / How to get makers errors
« on: November 20, 2017, 06:47:01 PM »
Dear all,

I am quite new in Photoscan scripting, and I try to export markers errors.
I have tried this code in order to have the mean error foreach marker :

Code: [Select]

def computeMeanErrorForeachMarker():
listErrors = []
run = 0
for marker in chunk.markers:
sumError = 0
num = 0
cam = chunk.cameras
for camera in cam:
print(marker)
print(camera)
v_proj = marker.projections[camera].coord
v_reproj = camera.project(marker.position)
diff = (v_proj - v_reproj).norm()
sumError += diff
num += 1
if(num>0):
meanError = sumError / num
else:
meanError = 0
listErrors.append(meanError)
return listErrors

 
listE = computeMeanErrorForeachMarker()
print(listE)


but I have the following error :

"Traceback (most recent call last):
File "C:\ToolsPerso\scripts-photoscan\script_compute_error_by_marker.py", line 31, in <module>
listE = computeMeanErrorForeachMarker()
File "C:\ToolsPerso\scripts-photoscan\script_compute_error_by_marker.py", line 18, in computeMeanErrorForeachMarker
v_proj = marker.projections[camera].coord
AttributeError: 'NoneType' object has no attribute 'coord' "

Can you please help me ?
Ps : I have searched in many topics, but nobody seems to have the same error as me ...

Thanks

Cindy.

Pages: [1]