Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - wangyanru

Pages: [1]
In photoscan v1.4.4,    when I use the xml format camera parameters exported from  from photoscan v1.2   ,the  dense cloud point can not be reconstructed correctly.

Is there any difference between  photoscan v1.4.4 and  photoscan v1.2 ?and how can i correct the camera xml file from v.1.2 to v1.4.4?

Python and Java API / export Render photos
« on: January 22, 2019, 06:02:18 PM »
In new version photoscan v1.4,we can export the rendered photos in the UI ,export->render photos,and there also need some manual operations to chose suitable projection plane,and the render results seems like rectified images based on source images .   so is there any method to get  render photos from specific views by python scripts? I have tried the examples like this:

Code: [Select]
import PhotoScan
import os

# Checking compatibility
compatible_major_version = "1.4"
found_major_version = ".".join('.')[:2])
if found_major_version != compatible_major_version:
    raise Exception("Incompatible PhotoScan version: {} != {}".format(found_major_version, compatible_major_version))

def get_cameras(chunk):
    selected_cameras = [camera for camera in chunk.cameras[0:32] if camera.transform and camera.selected]

    if len(selected_cameras) > 0:
        return selected_cameras
        return [camera for camera in chunk.cameras if camera.transform]

def render_cameras():
    print("Script started...")

    chunk =[0]
    #chunk2 =[1]
    if not chunk.model:
        raise Exception("No model!")

    for camera in get_cameras(chunk):
        render = chunk.model.renderImage(camera.transform, camera.sensor.calibration)

        photo_dir = os.path.dirname(
        photo_filename = os.path.basename(
        render_filename = os.path.splitext(photo_filename)[0] + "_render.jpg", render_filename))

    print("Script finished!")

label = "Custom menu/Render photos for cameras", render_cameras)
print("To execute this script press {}".format(label))

but the results is not as expected as exported results from UI (render photos)   ,   can anyone explain and give some tips?

Pages: [1]