Forum

Author Topic: programatically set coordinates of automatically detected ground control markers  (Read 5822 times)

beerockxs2

  • Newbie
  • *
  • Posts: 6
    • View Profile
Hi there,

I'm trying to set the coordinates of my detected groudn control markers programmatically, and it's not working.
Here's the code I'm using:

    chunk.detectMarkers('12bit',95)
    for marker in chunk.markers:

        gcl = PhotoScan.GroundControlLocation(chunk,marker)
        if marker.label == "target 373":
            print("setting coord for marker 373")
            gcl.coord = {357694.233,5609773.51639,227.900330}

The detection does work, the coordinate setting not. What do I need to change?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14765
    • View Profile
Hello beerockxs2,

And what is the console output message for this script?
Best regards,
Alexey Pasumansky,
Agisoft LLC

James

  • Hero Member
  • *****
  • Posts: 748
    • View Profile
Auto detected markers are created as not enabled and without coordinates. The enabled and coord properties are not accessible through python until the markers have been assigned some coordinates. It looks like you have to manually enable the markers by checking the boxes, which will initialise them with 0,0,0 before your script will work.

beerockxs2

  • Newbie
  • *
  • Posts: 6
    • View Profile
Hello beerockxs2,

And what is the console output message for this script?
There is no output regarding the markers, photo matching, image alignment, dense cloud and model building work as normal, but the detected markers stay disabled and have no coordinates assigned to them.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14765
    • View Profile
Hello beerockxs2,

I think you should do the following:

Code: [Select]
gc = chunk.ground_control
locations = gc.locations
for marker in chunk.markers:
   locations.add(marker)
   if marker.label == "target 373":
      locations[marker].coord = ([357694.233, 5609773.51639, 227.900330])

ground_control.apply()
PhotoScan.app.update()
Best regards,
Alexey Pasumansky,
Agisoft LLC

beerockxs2

  • Newbie
  • *
  • Posts: 6
    • View Profile
Hello beerockxs2,

I think you should do the following:

Code: [Select]
gc = chunk.ground_control
locations = gc.locations
for marker in chunk.markers:
   locations.add(marker)
   if marker.label == "target 373":
      locations[marker].coord = ([357694.233, 5609773.51639, 227.900330])

ground_control.apply()
PhotoScan.app.update()
With a minor change (gc.apply() instead of ground_control.apply()) this worked just fine. Thanks for the quick response!