Forum

Author Topic: Importing and detecting coded markers  (Read 7529 times)

william

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Importing and detecting coded markers
« on: April 20, 2017, 07:02:57 PM »
Hi,

I am using the 12-bit coded markers, and Photoscan 1.3.1. I plan to use PhotoScan.detectMarkers() to automatically detect.

I have GPS coordinates for each marker, but I don't know how to import the marker reference coordinates into Photoscan so that the detected markers are mapped properly to the imported markers. Should I use chunk.importMarkers() or chunk.loadReference()? And how do I specify which marker is which? Do I need to know the numeric ID of the coded marker that I selected when printing?

Currently my plan is the following:

Code: [Select]
    # Assume I already have the chunk set up and photos imported.

    chunk.crs = PhotoScan.CoordinateSystem("EPSG::32613")
    chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy)
    chunk.alignCameras(adaptive_fitting=True)
    chunk.buildDenseCloud(quality=PhotoScan.UltraQuality, filter=PhotoScan.MildFiltering)
    PhotoScan.app.document.save("project.psx")
    chunk.loadReference(path='reference.csv', format=PhotoScan.ReferenceFormatCSV, columns=’nxyzXYZ’,
delimiter)   
    chunk.detectMarkers(type=PhotoScan.CircularTarget12bit)
    PhotoScan.app.document.save("project.psx")

...But I'm not sure if the order is correct, or if loadReference() is correct, or if I need to save the project.psx at a different place.

Here is my reference.csv layout:
Can I get some help? Thanks.

william

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Importing and detecting coded markers
« Reply #1 on: April 20, 2017, 07:07:46 PM »
Hi,

I am using the 12-bit coded markers, and Photoscan 1.3.1. I plan to use PhotoScan.detectMarkers() to automatically detect.

I have GPS coordinates for each marker, but I don't know how to import the marker reference coordinates into Photoscan so that the detected markers are mapped properly to the imported markers. Should I use chunk.importMarkers() or chunk.loadReference()? And how do I specify which marker is which? Do I need to know the numeric ID of the coded marker that I selected when printing?

Currently my plan is the following:

Code: [Select]
    # Assume I already have the chunk set up and photos imported.

    chunk.crs = PhotoScan.CoordinateSystem("EPSG::32613")
    chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy)
    chunk.alignCameras(adaptive_fitting=True)
    chunk.buildDenseCloud(quality=PhotoScan.UltraQuality, filter=PhotoScan.MildFiltering)
    PhotoScan.app.document.save("project.psx")
    chunk.loadReference(path='reference.csv', format=PhotoScan.ReferenceFormatCSV, columns=’nxyzXYZ’,
                                          delimiter=',')   
    chunk.detectMarkers(type=PhotoScan.CircularTarget12bit)
    PhotoScan.app.document.save("project.psx")

...But I'm not sure if the order is correct, or if loadReference() is correct, or if I need to save the project.psx at a different place.

Here is my reference.csv layout:
Code: [Select]
label,easting,northing,altitude,easting_accuracy,northing_accuracy,altitude_accuracy
???,X.X,X.X,X.X,X.X,X.X,X.X

Can I get some help? Thanks.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Importing and detecting coded markers
« Reply #2 on: April 20, 2017, 07:08:34 PM »
Hello William,

At first you need to detect markers and then to import the coordinates for them. In your case loadReference() is proper option, since the projections on the photos would be detected automatically during detectMarkers() step.

And in the imported file you need to use the target IDs that correspond to the printed markers document.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Importing and detecting coded markers
« Reply #3 on: April 20, 2017, 07:12:07 PM »
Also I can suggest to put PhotoScan.app.document.save("project.psx") in the beginning of the script, and after that use PhotoScan.app.document.save(), unless you need to save the project copies under different names.
Best regards,
Alexey Pasumansky,
Agisoft LLC

william

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: Importing and detecting coded markers
« Reply #4 on: April 20, 2017, 07:15:59 PM »
Thanks so much! I've attached the markers PDF I was able to print. I can't see any numbering, so I assume the ID is the page number? (I have one marker per page). Or have I missed something?

P.S. sorry about the duplicate posts.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Importing and detecting coded markers
« Reply #5 on: April 20, 2017, 07:18:02 PM »
Hello william,

These markers from the document wouldn't work. They are not fully present on the pages, while PhotoScan requires complete target visible on the image.
Best regards,
Alexey Pasumansky,
Agisoft LLC

william

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: Importing and detecting coded markers
« Reply #6 on: April 20, 2017, 07:25:28 PM »
Ah, I see a tiny number in the bottom left corner of each page. So based on http://www.agisoft.com/forum/index.php?topic=6728.0, my format should be the following:
Code: [Select]
#label,northing,...
point 1,X.X,...
point 2,X.X,...



Also, I assumed that I could simply print the documents on a larger sheet of paper.
Reply #14 on http://www.agisoft.com/forum/index.php?topic=2768.0 seems to indicate they were able to do that.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Importing and detecting coded markers
« Reply #7 on: April 20, 2017, 07:29:34 PM »
Hello william,

Maybe there's something wrong with the PDF viewer I'm using to open the provided document, but I see only one target per page (actually, only half a target). You can see how the targets look like here:
http://www.agisoft.com/pdf/PS_1.1_Tutorial%20(IL)%20-%20Coded%20Targes%20and%20Scale%20Bars.pdf

Their names are "target 1", "target 2" and etc (without quotes, of course).
Best regards,
Alexey Pasumansky,
Agisoft LLC

william

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: Importing and detecting coded markers
« Reply #8 on: April 20, 2017, 07:38:29 PM »
Ok, so I will use target X instead of point X, thanks! Is it OK to pick and choose among the targets to find the most unique-looking ones (and number accordingly, e.g. target 5,target 26, etc.), or should I just use the first N targets?

I've attached a screenshot of a target visible in Inkscape on ubuntu. I am hopeful I can just print it out on a large page!

william

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: Importing and detecting coded markers
« Reply #9 on: April 20, 2017, 07:46:01 PM »
For future reference, here's a screenshot of me successfully resizing the canvas and dragging the markers in InkScape. Note how I had to select all the various vector elements (including the white!). Perhaps this will help someone in the future.

william

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: Importing and detecting coded markers
« Reply #10 on: May 19, 2017, 04:51:51 PM »
Just to confirm, the larger markers were successfully printed and used for a drone flight. Agisoft detected them no problem!

picare

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Importing and detecting coded markers
« Reply #11 on: December 13, 2017, 02:11:46 PM »
Hi,

In the case PhotoScan detected most of the markers but not all, and you got a file with the XYZ coordinate of all of your coded markers, in the scene:
- if you use chunk.loadReference(), all the detected markers will obtain coordinates but the markers not detected won't be created !
- if you manually add the markers with references > import, if you import an xml fil, it won't create the markers, but if you load a text file, it will ask you if you want to create them....

How can you automatically create these not detected markers which are present in the xml and txt file?

Thanks,

Pierre