Forum

Author Topic: Extracting rendered images from camera viewpoints  (Read 7292 times)

AiScan

  • Newbie
  • *
  • Posts: 2
    • View Profile
Extracting rendered images from camera viewpoints
« on: August 25, 2017, 12:36:47 PM »
Hello all,

I am trying to extract rendered images from camera viewpoints so I can compare them side by side. I am wanting to do something similar to the Visual Turing Test (http://grail.cs.washington.edu/projects/sq_rome_g1/), where an image and textured model are compared side by side to check for unwanted reconstruction artefacts. The 'look through' function doesn't give me what I want. It seems like it should be so simple but I can't figure it out. Does anyone have a python script that can do this?

Thanks!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15471
    • View Profile
Re: Extracting rendered images from camera viewpoints
« Reply #1 on: August 25, 2017, 02:08:26 PM »
Hello AiScan,

You can do it using Python:

Code: [Select]
import PhotoScan, os
chunk = PhotoScan.app.document.chunk
for camera in chunk.cameras:
   if not chunk.model:
      print(" no model" )
      break
   if not camera.transform:
      continue
   render = chunk.model.renderImage(camera.transform, camera.sensor.calibration)
   render.save(os.path.dirname(camera.photo.path + "//" + camera.label[:-4] + "_render.jpg")

It should save model renders for all aligned cameras to the same folder where the source photos are present with the "_render" suffix.
Best regards,
Alexey Pasumansky,
Agisoft LLC

AiScan

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Extracting rendered images from camera viewpoints
« Reply #2 on: August 25, 2017, 05:51:04 PM »
That's exactly what I wanted! Thanks so much!

nothing_more

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Extracting rendered images from camera viewpoints
« Reply #3 on: August 31, 2017, 09:33:02 AM »
And is there some option or code to make rendered image for one aligned camera (image) but with pixels from another aligned camera (another image)? This option may need to remove wires, trees and other things in post-editing process with multiple layers of one position and different locations of mentioned things (wires, etc.)..