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

Pages: [1]
1
Thank you very much Alexey!!!
It works!!!

Davide

2
Hello Alexey,
I made the change, no error comes out and Photoscan looks like in loop and in the top there is the write "Agisoft Photscan (dosen't respond) "

After few minutes the camera are all fix calibration, but the value of the f, cx, cy,.... are all equal to zero.

I know Alexey that it's long and difficult work to make me understand same Python but please make another effort to help me!!!

My script now is the following:

import PhotoScan

chunk = PhotoScan.app.document.chunk
for camera in chunk.cameras:
    index  = camera.label[camera.label.find("IMG") + 3]
    path = camera.photo.path.rsplit("/",1)[0] + "/camera" + index + ".xml"
    s = chunk.addSensor()
    s.label = camera.label
    s.user_calib = PhotoScan.Calibration()
    c = PhotoScan.Calibration()
    c.load(path)
    s.user_calib = c
    s.fixed  = True
    s.width = camera.photo.image().width
    s.height = camera.photo.image().height
    camera.sensor = s
 


Davide

3
Hello Alexey,
It dosen't work
I putted the 8 file
camera1.xml, camera2.xml,camera3.xml,camera4.xml,camera5.xml,camera6.xml,camera7.xml,camera8.xml,
in the same directory of the photos and as you suggested I cange path with the two lines you gave me in the previuos message.
See below

import PhotoScan

chunk = PhotoScan.app.document.chunk
for camera in chunk.cameras:
    index  = camera.label[c.label.find("IMG") + 3]
    path = camera.photo.path.rsplit("/",1)[0] + "/camera" + index + ".xml"
    s = chunk.addSensor()
    s.label = camera.label
    s.user_calib = PhotoScan.Calibration()
    c = PhotoScan.Calibration()
    c.load(path)
    s.user_calib = c
    s.fixed  = True
    s.width = camera.photo.image().width
    s.height = camera.photo.image().height
    camera.sensor = s

The software give me an error see attachment,
what can I do?

4
Hello Alexey,
I've 8 cameras and yes the naming convention is ...IMG5...

5
Hello Alexey,
I don't want to abuse of your patient and I need a solution.

My file photo structure is i.e. name_surnameIMG50000012.jpg where 5 is the name of the camera and 12 is the number of the photo that camera 5 made.

So I need to link camera5.xml file to all the 20 file.jpg

than I've to make the same thing with the other 7 cameras.

I can not write this link, can you help me?

Davide

6
Hello Alexey,
thank you, now it works!!!

In one of your previews message you mentioned the possibility to use sensor instances, is it possible?
Do you think use sensor instances will be easier? Now i've to edit each time the name of 200 xml files because my photos contain the name of the client and it's always different.

thank you for understanding

Davide

7
Hello Alexey,
unfortunately it doesn't work, and I think it's my fault, here below you can find what I wrote and attached the error the software gave me back, can you help me?

import PhotoScan
print("Start loading calibration")
chunk = PhotoScan.app.document.chunk
for camera in chunk.cameras:
    path = camera.photo.path[:-3] + "xml"
    s = chunk.addSensor()
    s.label = camera.label
    s.user_calib = PhotoScan.Calibration()
    c = PhotoScan.Calibration()
    c.load(path)
    s.user_calib = c
    s.fixed  = True
    s.width = camera.photo.image(5184)
    s.height = camera.photo.image(3456)
    camera.sensor = s
print("finish loading calibration")


8
Dear Alexey,
looking for a solution I found your suggestion to another user with similar problem. I tried to use the code you suggest but unfortunately I can not use it.
You suggested to use the following code:

        camera = PhotoScan.Camera()
        camera.open(cam_path)
        camera.label = camera.path.rsplit("/",1)[1]

        sensor = PhotoScan.Sensor()
   sensor.width = camera.width
   sensor.height = camera.height
        sensor.user_calib.load(calib_path)
        sensor.fixed = True

   camera.sensor = sensor 
   chunk.sensors.add(sensor)
   chunk.photos.add(camera)

I customized it in the following way but it dosen't work...

        camera = PhotoScan.Camera()
        camera.open(E:\OBJ\FracescaImg10000022.jpg)
        camera.label = camera.path.rsplit("/",1)[1]

        sensor = PhotoScan.Sensor()
   sensor.width = 3456
   sensor.height = 5184
        sensor.user_calib.load(E:\OBJ\camera1.xml)
        sensor.fixed = True

   camera.sensor = sensor 
   chunk.sensors.add(sensor)
   chunk.photos.add(camera)


can you please help me to understand?

thank you

davide
 


Hello Nan,

Yes, the place is right, but I recommend to create sensor instances manually in a loop across all cameras.

Code: [Select]


        camera = PhotoScan.Camera()
        camera.open(cam_path)
        camera.label = camera.path.rsplit("/",1)[1]

        sensor = PhotoScan.Sensor()
sensor.width = camera.width
sensor.height = camera.height
        sensor.user_calib.load(calib_path)
        sensor.fixed = True

camera.sensor = sensor 
chunk.sensors.add(sensor)
chunk.photos.add(camera)


If there is only one calibration group, the script should be modified accordingly.

9
Hello Alexey,
It'll be great!!!
because I'm not strong on Python but if you give me an example I can use it and customize it myself.
thank you

bye

Davide
 

10
Hello Alexey,
yes I've separated XML file for each camera

11
Hi to all,
I'm new I've built my own scanner with 8 canon and a rotating platform.

I made the cameras calibration with Lens and exported them in xml files.
In my workflow I use a python batch file to start a multiple psx files list and it works well.

My problem is the time consuming operation to load each time in each psx file the camera calibration parameter before starting with my batch file.

Is it possible to keep that value in the memory of Photoscan? Or is there  something that I can add to my python file to automatic load the camera calibration parameter?

My photos name are i.e. name of customer IMG_1000020.jpg where the number 1 is my camera and 20 is the 20th shoot of that camera.

Please help me to understand,

bye

Davide

Pages: [1]