Forum

Author Topic: Different output from API process and GUI workflow?  (Read 7491 times)

varadg

  • Newbie
  • *
  • Posts: 30
    • View Profile
Different output from API process and GUI workflow?
« on: February 22, 2017, 02:11:48 PM »
I am using the following script to automate my workflow of generating an orthomosaic for a set of 180 aerial photos -

Code: [Select]
doc = PhotoScan.app.document
doc.save("projects/frame_2.psx")

# add photos
chunk = doc.addChunk()
chunk.addPhotos(images)  # images is a list of image paths from a directory

# image matching and alignment
for frame in chunk.frames:
    frame.matchPhotos(accuracy=PhotoScan.HighAccuracy, preselection=PhotoScan.GenericPreselection, keypoint_limit=40000, tiepoint_limit=1000)
chunk.alignCameras()

# dense point cloud

chunk.buildDenseCloud(quality=PhotoScan.HighQuality,filter=PhotoScan.MildFiltering)

# build mesh
chunk.buildModel(surface=PhotoScan.HeightField, interpolation=PhotoScan.EnabledInterpolation, face_count=PhotoScan.HighFaceCount, source=PhotoScan.DenseCloudData, classes=[PhotoScan.Created])   # classes provide control on which kind of terrain we are mapping

# build UV
chunk.buildUV(mapping=PhotoScan.OrthophotoMapping)

# build texture
chunk.buildTexture(blending=PhotoScan.MosaicBlending, size=8192)

doc.save()

# build orthophoto
chunk.buildOrthomosaic()

# export orthophoto
chunk.exportOrthomosaic(path="projects/frame_2.tif", jpeg_quality=99)

However, at the end of processing, I noticed that the output obtained after processing the same dataset through the API  is drastically different from the output I obtain by following the orthophoto generation process (detailed here - http://www.agisoft.com/index.php?id=28) in the GUI.

I am running the Pro 30-day trial version on 64-bit Linux system with 8GB RAM & a GeForce GTX 740 graphics card.

Any idea why this would be happening?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #1 on: February 22, 2017, 02:15:06 PM »
Hello varadg,

It seems that you are not georeferencing the project, is that correct, do you see that the final project processed by the script is not Referenced?
Best regards,
Alexey Pasumansky,
Agisoft LLC

varadg

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #2 on: February 22, 2017, 02:21:30 PM »
Hi Alexey. Yes, that is correct, I do not have accurate georeference for the images I am using. But I am using the same images in both GUI & API.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #3 on: February 22, 2017, 02:30:19 PM »
Hello varadg,

Can you please generate the reports from both projects (processed via GUI and from Python) and post the links to them here or send to support@agisoft.com? Also please specify, which settings you are using in the Build Orthomosaic dialog when performing the processing from GUI?
Best regards,
Alexey Pasumansky,
Agisoft LLC

varadg

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #4 on: February 22, 2017, 02:34:40 PM »
Sure. Can you tell me how these reports are generated?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #5 on: February 22, 2017, 02:35:46 PM »
File Menu -> Generate Report.
Best regards,
Alexey Pasumansky,
Agisoft LLC

varadg

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #6 on: February 22, 2017, 02:37:20 PM »
And for the API?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #7 on: February 22, 2017, 02:47:23 PM »
Hello varadg,

If you have the project opened after Python processing, you can export report manually, or use:
Code: [Select]
chunk.exportReport(path = "projects/" + report.pdf)
Best regards,
Alexey Pasumansky,
Agisoft LLC

varadg

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #8 on: February 22, 2017, 05:05:37 PM »
The exportReport command crashed. However, I have sent all the other details to support@agisoft.com

Please let me know your analysis as soon as possible.

varadg

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #9 on: February 23, 2017, 09:13:10 AM »
Hi Alexey. Any updates on this?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #10 on: February 23, 2017, 03:12:14 PM »
Hello varadg,

I think that's not the best dataset to work with: it's only single flight-line (so no side overlap), the images are only 2 MPix (looks to be video frame sequence), no EXIF information. And also no coordinate information, so the default projection plane may not fit real XY plane.

So the main problem with this set is alignment issue, and I suggest to use more stable dataset (a few side-lapping flight lines) for script testing purposes. For more accurate estimation of the intrinsic camera parameters, I also recommend to turn the camera, when the aerial vehicle is returning, instead of using exactly the same camera orientation for all the flight lines.

Best regards,
Alexey Pasumansky,
Agisoft LLC

varadg

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #11 on: February 24, 2017, 10:21:44 AM »
Hi Alexey. I appreciate that this isn't the best input and yes I am restricted to 2MP only due to legal regulations on data acquisition. This data is from a single flight line only and, yes, I am working to get EXIF information and geotags.

However, this does not answer the question of why I get different output on the same dataset, using the same parameters in the API & the GUI. If the problem is with the data, why is the output of the GUI better than what I get with the API? I am happy with the output I get from the GUI and I'd like to be able to get the same from the API.

If that cannot be addressed, I would at least like to know the answer to the last question I had posed in my mail. While processing through the GUI, if I do automatic image alignment, only 50 images out of the 180 have green tick marks on them - I assume that means that they are the ones used for further processing. However, I can manually use Ctrl+A to choose all the images and then the output is much better, the number of points detected is larger. How can I ensure all images are used for processing using the API?

varadg

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #12 on: February 24, 2017, 10:32:59 AM »
Is it possible to schedule a call where I can show you the difficulty I am facing?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #13 on: February 24, 2017, 10:57:28 AM »
The alignment result is unstable, so you can get different output each time you run the processing from GUI or from script.
Best regards,
Alexey Pasumansky,
Agisoft LLC

varadg

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Different output from API process and GUI workflow?
« Reply #14 on: February 24, 2017, 12:22:56 PM »
Okay. So I guess the only way to get stable alignment is using geotags then? Also, are there any changes / improvements that can be made to my script?

Finally, what about the option of directing usage of all images rather than depending on the automatic selection for alignment? I have attached a screenshot of what I men. As you can see, not all of the images have ticks on them. After I do Ctrl+A on all the photos in the window, I get a very different result.