Forum

Author Topic: Importing markers  (Read 3468 times)

Osmrecek

  • Newbie
  • *
  • Posts: 4
    • View Profile
Importing markers
« on: April 13, 2017, 06:12:11 PM »
Hello, i exported markers from 10 photos in chunk. Now i reduced resolution of these photos to 50% for compare how resulution affect result. i want to use same markers to reduced photos and it did not work.

My question is, is it possible to use original photos markers file and "tell" it, that photos was reduced to 50% to make it work? if yes, how?Thanks for answers.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14753
    • View Profile
Re: Importing markers
« Reply #1 on: April 13, 2017, 06:20:38 PM »
Hello Osmrecek,

And what's the reason of using downscaled images?

You can correct the marker projections only manually fixing the XML file or running script that will divide all the coordinates of the projections of the imported markers by 2.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Osmrecek

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Importing markers
« Reply #2 on: April 13, 2017, 06:29:15 PM »
Hello, im doing it for school project. Can you tell me where i can get the script? im talking about hundred of markers so doing it manually takes time.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14753
    • View Profile
Re: Importing markers
« Reply #3 on: April 13, 2017, 06:35:08 PM »
Hello Osmrecek,

You can use Accuracy and Quality parameters in the Align Photos and Build Dense Cloud dialogs to control the downscaling of the images.

The script would be the following:
Code: [Select]
import PhotoScan
chunk = PhotoScan.app.document.chunk
for marker in chunk.markers:
      for camera in marker.projections.keys()
            marker.projections[camera].coord = marker.projections[camera].coord / 2.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Osmrecek

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Importing markers
« Reply #4 on: April 13, 2017, 06:52:45 PM »
i really dont know how to use it exactly, never done it before, can you write it more specific - step by step when i import reduced photos, like for me - beginner?
Thanks a lot!  :)

Serob

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Importing markers
« Reply #5 on: February 06, 2019, 12:49:03 AM »
Hello,

I am trying to use this code after importing markers, but in this case marker.projections.keys()  (also .values() and .items() ) returns an empty array.
I tried to export markers with coordinates explicitly, like:
Code: [Select]
chunk.exportMarkers(markers_file, doc.chunk.crs)Also tried to do suggested decimation after/before camera alignment and with/without camera importing, but nothing works.

Any ideas?

Hello Osmrecek,

You can use Accuracy and Quality parameters in the Align Photos and Build Dense Cloud dialogs to control the downscaling of the images.

The script would be the following:
Code: [Select]
import PhotoScan
chunk = PhotoScan.app.document.chunk
for marker in chunk.markers:
      for camera in marker.projections.keys()
            marker.projections[camera].coord = marker.projections[camera].coord / 2.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14753
    • View Profile
Re: Importing markers
« Reply #6 on: February 06, 2019, 12:54:40 PM »
Hello Serob,

Which task you are trying to solve, and whether you are observing any error messages in the Console pane when running this script block?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Serob

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Importing markers
« Reply #7 on: February 06, 2019, 04:47:49 PM »
Hello Alexey, thank you for your reply.

So my problem is the following:
Initially I had a human body scan with markers in it. Each picture of the scan had 8 megapixel size. I exported the markers in a standard way into .xml file:
Code: [Select]
chunk.exportMarkers(markers_file, doc.chunk.crs)
Now I wish to use the same markers for another scan, pictures sizes of which are 4 megapixel. I import them:
Code: [Select]
chunk.importMarkers(markers_file)and then try to resize markers' coordinates. So I run a code that you have suggested. No error in the console pane during the execution of your piece of code. It just  doesn't enter into inner for loop. I  have printed the marker.projections.keys() (also  marker.projections.values() and marker.projections.items() ) and they are empty.

Hello Serob,

Which task you are trying to solve, and whether you are observing any error messages in the Console pane when running this script block?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14753
    • View Profile
Re: Importing markers
« Reply #8 on: February 06, 2019, 05:36:06 PM »
Hello Serob,

You need at first to modify manually in the exported XML file the dimensions of the sensor in the <resolution> sections according to the applied ratio.

Then import this modified XML and execute the script:
Code: [Select]
import PhotoScan
chunk = PhotoScan.app.document.chunk
for marker in chunk.markers:
      for camera in marker.projections.keys()
            marker.projections[camera] = PhotoScan.Marker.Projection(marker.projections[camera].coord * 0.5, True)
Best regards,
Alexey Pasumansky,
Agisoft LLC

Serob

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Importing markers
« Reply #9 on: February 07, 2019, 12:17:23 AM »
Thanks.
It worked!!!