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

Pages: [1] 2
1
Yes, the two topics are related. And the solution for the other one can works here, thank you.

2
So, I've tested it, and it seems to be good,

Just little changes :

Code: [Select]
T = chunk.transform.matrix
ptSrcT = T.inv().mulp(chunk.crs.unproject(ptSrc))
ptDstT = T.inv().mulp(chunk.crs.unproject(ptDst))
pT = chunk.model.pickPoint(ptSrcT, ptDstT)

m = chunk.addMarker(pT)


3
Ok, I'm sorry  :-X, I haven't seen the definition of T ... Thank you ! I'll test it today. :)

4
First of all, hello Paulo and thank you for replying.
I thought the same thing, but the problem seems to be that PhotoScan has two coordinates systems in its own :
when I pick a point with the ruler tool, I get a coordinate and when I print the coordinate of the same point by script, I get another coordinate. In fact, it seems that PhotoScan has an internal coordinate system and a display coordinate system.
I don't know how to pass from one to the other one.

Also, you don't have the same coordinates if you use many ways to print them : for a marker, you have marker.reference.location and  marker.position for example. And the two methods don't retrieve the same coordinates for the same marker.

5
Anybody ?

6
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

7
Ok, It seems I've found my mistake :


Code: [Select]
v = PhotoScan.Vector([myPoint[0], myPoint[1], myPoint[2]])
m = chunk.addMarker()
m.reference.location = v

But the problem stays : if I want to use pickPoint(#vector3d#, #vector3d#) in order to do raytracing for picking point, the coordinates that I input with my two vectors seems to not be in the good system. And my picked point appears at the wrong place.

8
Python and Java API / Re: Python scripting
« on: June 08, 2018, 10:52:37 AM »
Hello AlexShura,

You have http://www.agisoft.com/pdf/photoscan_python_api_1_4_0.pdf.
(This is for the 1.4 version, take care of it)

The importants things are :
Code: [Select]
import PhotoScan #(at the begining of your script)

#and then, in order to open PhotoScan, you call 
app = PhotoScan.Application()
doc = app.document

#To save :
doc.save(#path + project name#)

#add a new chunk :
chunk = doc.addChunk()

#add photos :
chunk.addPhotos(photoList)       # photoList = a tab with strings

etc.. for the rest, you can find it on the doc.

Let us know if you block on another point.

9
After some tests, it seems that there is some inconsistency :
Photoscan detects automatically one target on my project. When I read its coordinates, they are 4 times bigger than when I pick the target by another program.
But, when I use PhotoScan to pick point with the ruler tool, it gives me the coordinate of the target and it is the same that the one picked by my program, and not returned by PhotoScan.

print(target.position) ---> PhotoScan gives me : Vector([-5.663896887909959, -0.7403848828696588, -11.303984398252654])

picked by my program ---> Vector([-1.3575199675979093, -0.1761938076466322, -2.72407025591208])
picked with the ruler tool oh PhotoScan ---> Ruler coordinates:  -1.353966 X  -0.177330 Y  -2.702 m

10
Hello Alexey,
Thank you for your response.
When I use reference.location = v, I've got an error that says : " 'PhotoScan.Marker.Reference' object attribute 'location' is read-only ".

11
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

12
Python and Java API / Re: How to get makers errors
« on: March 28, 2018, 04:47:20 PM »
Hi Erik,
Thank you for your answer !
I must admit that for lack of solution I put this problem aside.
So I'm going to think about with your solution and test it on my side.

Cindy.

13
Python and Java API / Re: How to get makers errors
« on: January 26, 2018, 05:02:39 PM »
Thank you Eriksh for your code, but it gives me only the errors for the markers wich I know real coordinates.
I want to retrieve the error of my estimated markers positions. I haven't their real position, just their coordinates in the local system and their estimation in the new system.

14
Python and Java API / Re: How to get makers errors
« on: January 19, 2018, 07:07:59 PM »
Quote
If you want the total marker error:

Code: [Select]

doc = PhotoScan.app.document
chunk = doc.chunk

for marker in chunk.markers:
    est = chunk.crs.project(chunk.transform.matrix.mulp(marker.position))  # Gets estimated marker coordinate
    ref = marker.reference.location

    if est and ref:
        error = (est - ref).norm()  # The .norm() method gives the total error. Removing it gives X/Y/Z error
        print(marker.label, error)


That code gives the same error values for me.


Thank you so much eriksh, i'll test that next week !

15
Thank you for your response Alexey, it helps me a lot !

Pages: [1] 2