Forum

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 - benton

Pages: [1] 2
1
General / Metashape Height Conversion Problem
« on: July 07, 2023, 08:42:36 AM »
Metashape Version 2.0.2 build 16404 (64 bit)
Camera System Hasselblad A6D

AOI Flown at 6500ft ASL

Exif in image under heading GPS looks like this;
Lattitude 33; 42; 54.014...
Longitude 115; 59; 22.5914...
Altitude 2080

I am experiencing the following behaviour for photos imported into Metashape under Model > Add Photos;

Longitude 115.98 ...
Latitude -33.71 ...
Altitude (m) 113.92

I am confused as to how the altitude has been changed from 2080 to 113.92

In the previous post I was asked to provide the output from the following command

Code: [Select]
Metashape.app.document.chunk.cameras[0].photo.imageMeta()
Output;

Code: [Select]
Metashape.app.document.chunk.cameras[0].photo.imageMeta()
Out[1]: 2023-07-07 10:51:39
2023-07-07 10:51:39 {'Exif/ApertureValue': '2048/441', 'Exif/DateTimeDigitized': '2022-05-18T06:17:05', 'Exif/DateTimeOriginal': '2022-05-18T06:17:05', 'Exif/ExifVersion': '0210', 'Exif/ExposureProgram': '1', 'Exif/ExposureTime': '1/4000', 'Exif/FNumber': '5/1', 'Exif/Flash': '0', 'Exif/FocalLength': '80/1', 'Exif/FocalLengthIn35mmFilm': '51', 'Exif/FocalPlaneResolutionUnit': '3', 'Exif/FocalPlaneXResolution': '217391304/100000', 'Exif/FocalPlaneYResolution': '217391304/100000', 'Exif/GPSAltitude': '11392/100', 'Exif/GPSDate': '2023:01:23', 'Exif/GPSLatitude': '33,42.9002S', 'Exif/GPSLongitude': '115,59.3765E', 'Exif/GPSTime': '02:31:27', 'Exif/GPSTimeStamp': '2:31:27.00', 'Exif/GPSVersionID': '2.2.0.0', 'Exif/ISOSpeedRatings': '400', 'Exif/Make': 'Hasselblad', 'Exif/MaxApertureValue': '316992500/100000000', 'Exif/Model': 'Hasselblad A6D-100c', 'Exif/ShutterSpeedValue': '16384/1369', 'Exif/SubjectDistance': '-1/0', 'Exif/XMLPacket': '<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
2023-07-07 10:51:39 <x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b" xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"><photoshop:DateCreated>2022-05-18T06:17:05</photoshop:DateCreated></rdf:Description><rdf:Description rdf:about="uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b" xmlns:exif="http://ns.adobe.com/exif/1.0/"><exif:ExifVersion>0210</exif:ExifVersion><exif:DateTimeOriginal>2022-05-18T06:17:05</exif:DateTimeOriginal><exif:DateTimeDigitized>2022-05-18T06:17:05</exif:DateTimeDigitized><exif:ISOSpeedRatings><rdf:Bag xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:li>400</rdf:li></rdf:Bag>
2023-07-07 10:51:39             </exif:ISOSpeedRatings><exif:ExposureTime>1/4000</exif:ExposureTime><exif:ShutterSpeedValue>16384/1369</exif:ShutterSpeedValue><exif:FNumber>5/1</exif:FNumber><exif:ApertureValue>2048/441</exif:ApertureValue><exif:FocalLength>80/1</exif:FocalLength><exif:FocalLengthIn35mmFilm>51</exif:FocalLengthIn35mmFilm><exif:ExposureProgram>1</exif:ExposureProgram><exif:Flash>0</exif:Flash><exif:SubjectDistance>-1/0</exif:SubjectDistance><exif:MaxApertureValue>316992500/100000000</exif:MaxApertureValue><exif:FocalPlaneXResolution>217391304/100000</exif:FocalPlaneXResolution><exif:FocalPlaneYResolution>217391304/100000</exif:FocalPlaneYResolution><exif:FocalPlaneResolutionUnit>3</exif:FocalPlaneResolutionUnit><exif:GPSVersionID>2.2.0.0</exif:GPSVersionID><exif:GPSLatitude>33,42.9002S</exif:GPSLatitude><exif:GPSLongitude>115,59.3765E</exif:GPSLongitude><exif:GPSAltitude>11392/100</exif:GPSAltitude><exif:GPSTimeStamp>2:31:27.00</exif:GPSTimeStamp></rdf:Description><rdf:Description rdf:about="uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b" xmlns:aux="http://ns.adobe.com/exif/1.0/aux/"><aux:Lens>HC 80</aux:Lens><aux:SerialNumber>AR37000030</aux:SerialNumber></rdf:Description><rdf:Description rdf:about="uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b" xmlns:tiff="http://ns.adobe.com/tiff/1.0/"><tiff:Make>Hasselblad</tiff:Make><tiff:Model>Hasselblad A6D-100c</tiff:Model></rdf:Description></rdf:RDF></x:xmpmeta>
2023-07-07 10:51:39 <?xpacket end='w'?>', 'File/ImageHeight': '8700', 'File/ImageWidth': '11600'}

I think this is what is creating the calculation for 113.92  (see below)

Code: [Select]
<exif:GPSAltitude>11392/100</exif:GPSAltitude>
When I use exiftools to extract exif for image 1 the column named GPSAltitude states the following;

GPSAltitude   GPSDateTime   GPSLatitude   GPSLongitude
2080   2023:01:23 02:31:27Z   -33.71500394   115.9896088


Regards
Bn

This is a resurection of a previous post;
https://www.agisoft.com/forum/index.php?topic=12652.msg56159#msg56159

2
Python and Java API / Point Classification for Version 2.0
« on: June 29, 2023, 08:32:55 AM »
Metashape version 2.0.2
OS Win 10


Hello,

I would like to classify ground points using Metashape python script, but I am having difficulty finding the correct syntax.

This is what I have tried so far;

Code: [Select]
# chunk.PointCloud.classifyPoints(Unclassified,Ground)
# PointCloud.classifyPoints(Unclassified,Ground)
# chunk.PointCloud.classifyGroundPoints(max_angle=15.0,max_distance=1.0,cell_size=50.0,erosion_radius=0.0)
# chunk.classifyPoints(Unclassified,Ground)
# chunk.classifyGroundPoints(max_angle=15.0,max_distance=1.0,cell_size=50.0,erosion_radius=0.0)
# chunk.DepthMapsData.classifyPoints(Unclassified,Ground)
# chunk.dense_cloud.classifyPoints(source = Metashape.PointClass.Created, target = [Metashape.PointClass.Ground], confidence=0.01)
# chunk.PointCloudData.classifyPoints(source = Metashape.PointClass.Created, target = [Metashape.PointClass.Ground], confidence=0.01)
chunk.classifyPoints(source = Metashape.PointCloudData, target = [Metashape.PointClass.Ground], confidence=0.01)

This is a workflow that I am using and would like to insert a classification component (I have included the failed lines of classification);

Code: [Select]
print('Match Photos')
chunk.matchPhotos(\
downscale=v_accuracy,\
generic_preselection=False,\
reference_preselection=True,\
guided_matching=False,\
filter_mask=False,\
keypoint_limit=v_keypoints,\
tiepoint_limit=v_tiepoints\
)
doc.save()

print('Align Cameras')
chunk.alignCameras()
doc.save()

print('Optimise Cameras')
chunk.optimizeCameras(\
fit_f=True,fit_cx=True,\
fit_cy=True,fit_b1=True,\
fit_b2=True,fit_k1=True,\
fit_k2=True,fit_k3=True,\
fit_k4=False,fit_p1=True,\
fit_p2=True,fit_p3=False,\
fit_p4=False,adaptive_fitting=True,\
tiepoint_covariance=True\
)
doc.save()

print('Build Depth Maps')
chunk.buildDepthMaps(downscale=v_quality, filter_mode=v_filter)
doc.save()

print('Build Point Cloud')
chunk.buildPointCloud(\
source_data=Metashape.DepthMapsData\
, point_colors=True\
)
doc.save()

print('Classify Point Cloud')
# chunk.PointCloud.classifyPoints(Unclassified,Ground)
# PointCloud.classifyPoints(Unclassified,Ground)
# chunk.PointCloud.classifyGroundPoints(max_angle=15.0,max_distance=1.0,cell_size=50.0,erosion_radius=0.0)
# chunk.classifyPoints(Unclassified,Ground)
# chunk.classifyGroundPoints(max_angle=15.0,max_distance=1.0,cell_size=50.0,erosion_radius=0.0)
# chunk.DepthMapsData.classifyPoints(Unclassified,Ground)
# chunk.dense_cloud.classifyPoints(source = Metashape.PointClass.Created, target = [Metashape.PointClass.Ground], confidence=0.01)
# chunk.PointCloudData.classifyPoints(source = Metashape.PointClass.Created, target = [Metashape.PointClass.Ground], confidence=0.01)
chunk.classifyPoints(source = Metashape.PointCloudData, target = [Metashape.PointClass.Ground], confidence=0.01)
doc.save()

print('Export Point Cloud')
chunk.exportPointCloud(\
output_path + "/_RGB_POINT_CLOUD/input.laz"\
, crs=v_crs_to\
, source_data=Metashape.PointCloudData\
, save_point_color=True\
, save_point_classification=True\
, format=Metashape.PointCloudFormatLAZ\
)
doc.save()


Thank You
Ben

3
General / Metashape Height Conversion
« on: October 12, 2020, 05:38:56 AM »
Metashape Version 1.6.5 build 11249 (64 bit)
Camera System Hasselblad A6D

AOI Flown at 6500ft ASL

Exif in image under heading GPS looks like this;
Lattitude 34; 26 ;44.0313...
Longitude 115; 57;19.709 ...
Altitude 2044

I am experiencing the following behaviour for photos imported into Metashape under Model > Add Photos;

Longitude 115.95 ...
Latitude -34.44 ...
Altitude (m) 56.92

I am confused as to how the altitude has been changed from 2044 to 56.92

Regards
Bn

4
Python and Java API / Reference Settings - Measurement Accuracy
« on: February 12, 2020, 02:24:06 AM »
Metashape 1.6.x

Hello,

Is there a way to set a default value in Reference Settings > Measurement Accuracy > Camera Accuracy (m) in python script.

It appears to have a default of 10 and I would like to set it to another value.

Regards
Ben

5
Python and Java API / How to solve Export Raster file size exceeded
« on: February 10, 2020, 06:09:47 AM »
Hello,

Version 1.6.x

I have a script that worked in 1.5 but is throwing an error in 1.6

The working 1.5 script looked like this;

Code: [Select]
v_blockw = 10000
v_blockh = 10000

...

chunk.exportOrthomosaic(output_path +'/ORTHO_TILE/'+ project_name + "_Ortho_EPSG" + v_to_epsg + "_ver_" + version + ".tif", image_format=Metashape.ImageFormatTIFF, projection=v_projection, blockw=v_blockw, blockh=v_blockh)

and the 1.6 script;

Code: [Select]
v_blockw = 10000
v_blockh = 10000

...

chunk.exportRaster(output_path +'/ORTHO_TILE/'+ project_name + "_Ortho_EPSG" + v_to_epsg + "_ver_" + version + ".tif", image_format=Metashape.ImageFormatTIFF, projection=v_projection, block_width=v_blockw, block_height=v_blockh, source_data=Metashape.OrthomosaicData)

Throws the following error
Code: [Select]
ExportRaster: image_format = TIFF, path = h:\SILREC_201912\mtn0618-ii/ORTHO_TILE/mtn0618-ii_Ortho_EPSG28350_ver_i.tif, projection = GDA94 / MGA zone 50
generating 40857 x 40495 raster in 1 x 1 tiles
libtiff error: Maximum TIFF file size exceeded
Traceback (most recent call last):
  File "U:\SCRIPTS\METASHAPE\metashape_A6D_Camera_Feedback_1.6-ver2.py", line 224, in <module>
    chunk.exportRaster(output_path +'/ORTHO_TILE/'+ project_name + "_Ortho_EPSG" + v_to_epsg + "_ver_" + version + ".tif", image_format=Metashape.ImageFormatTIFF, projection=v_projection, block_width=v_blockw, block_height=v_blockh, source_data=Metashape.OrthomosaicData)
RuntimeError: TIFFWriteTile: unexpected error: d:\folder_name/OrhtoName_Ortho_EPSG28350_ver_i.tif

The error indicates that the tiff image is too big 40857 x 40495, but I assume I have directed the script to output 10000 x 10000 tiles.

Can anyone see what the error could be?

Regards
Ben


6
Hello

Metashape Version 1.6

I have a script that I ran in 1.5 but has stopped working.

The problem is related to projection.

Previously I had the following;

Code: [Select]
v_projection=Metashape.CoordinateSystem('EPSG::28350')
and when I wanted to export a component of my project I could do this;

Code: [Select]
chunk.exportRaster(output_path +'/DEM/'+ project_name + "_DEM_EPSG" + v_to_epsg + "_ver_" + version + ".tif",image_format=Metashape.ImageFormatTIFF, [b]projection=v_projection[/b], source_data=Metashape.ElevationData)
or

Code: [Select]
chunk.exportPoints(output_path + "/RGB_POINT_CLOUD/input.laz", [b]projection=v_projection[/b], source_data=Metashape.DenseCloudData, format=Metashape.PointsFormatLAZ)
But it no longer works.

I was advised to look at an example at
https://www.agisoft.com/forum/index.php?topic=11767.msg52733#msg52733

But I donot know how to apply the EPSG to the example;

Code: [Select]
projection = Metashape.OrthoProjection()
projection.type = Metashape.OrthoProjection.Type.Planar
#projection.matrix = proj #the matrix that is calculated based on markers
projection=Metashape.CoordinateSystem('EPSG::28350')

Previous Version
Code: [Select]
exportPoints(path[, source ], binary=True, precision=6, normals=True, colors=True,
raster_transform=RasterTransformNone, colors_rgb_8bit=True[, comment ][,
format ][, image_format ][, projection][, shift ][, region ][, blockw ][, blockh ][,
classes ][, progress ])

Current Version 1.6
Code: [Select]
exportPoints(path=’‘, source_data=DenseCloudData, binary=True, save_normals=True,
save_colors=True, save_classes=True, save_confidence=True,
raster_transform=RasterTransformNone, colors_rgb_8bit=True, comment=’‘,
save_comment=True, format=PointsFormatNone, image_
format=ImageFormatJPEG[, crs ][, shift ][, region ], block_width=1000,
block_height=1000, split_in_blocks=False[, classes ], save_images=False[, viewpoint
], subdivide_task=True[, progress ])
Regards
Ben

7
Python and Java API / exportRaster Syntax for DEM
« on: February 04, 2020, 05:46:04 AM »
Hello,

I have upgraded my Metashape version to 1.6.

Scripts that I have been using require updating, I have been able to find some of the changes through the change log for 1.6 Python Scripting.

But I am having trouble with the following;

In 1.5 the following ran without error;

Code: [Select]
chunk.exportDem(output_path +'/DEM/'+ project_name + "_DEM_EPSG" + v_to_epsg + "_ver_" + version + ".tif",image_format=Metashape.ImageFormatTIFF, projection=v_projection)

But in 1.6 I have attempted to apply the change as follows;

Code: [Select]
chunk.exportRaster(output_path +'/DEM/'+ project_name + "_DEM_EPSG" + v_to_epsg + "_ver_" + version + ".tif",image_format=Metashape.ImageFormatTIFF, projection=v_projection, source_data=DEMdata)

But the error message returning is;

NameError: name 'DEMdata' is not defined.

The change log says the following on page 33;

source_data (DataSource) – Selects between DEM and orthomosaic.

I have attempted to use the word DEM and get same error.

Does anyone know what the syntax is?

Ben

8
General / Dense Cloud Quality
« on: February 28, 2019, 02:34:13 AM »
Hello,

When I use these settings;

PhotoScan.UltraQuality
PhotoScan.HighQuality
PhotoScan.MediumQuality
PhotoScan.LowQuality
PhotoScan.LowestQuality

My understanding is the source image is used at original size (UltraQuality), down to reduced sizes dependent on setting used.

Is this process for the Dense Cloud production only?

Does the original high res image get used to produce the DEM and Ortho, or is it the reduced quality image used?

Regards
Ben

9
Python and Java API / buildDenseCloud throws error in 1.4
« on: July 02, 2018, 08:58:07 AM »
Hello,

After upgrading to 1.4 from 1.3 the following line in a script does not work;

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

I get the following error;
Traceback (most recent call last):
  File "U:\PhotoScan_Scripts\SANDBOX\photoscan_process_DJI_AND_A6D_p4p_for_orthophoto_1-4.py", line 154, in <module>
    chunk.buildDenseCloud(quality=PhotoScan.HighQuality, filter=PhotoScan.NoFiltering)
TypeError: 'filter' is an invalid keyword argument for this function

Regards
Ben

10
Python and Java API / Export Point Classes
« on: February 15, 2018, 04:48:52 AM »
Hi,

To export only specific point classes is the below the correct method;

Code: [Select]
chunk.exportPoints(mypath, source=PhotoScan.DenseCloudData, format=PhotoScan.PointsFormatLAS, projection=v_projection, blockw=1000, blockh=1000, classes=[1,2])
Ben

11
Python and Java API / Clarification of ModelData and Elevation-Data
« on: September 22, 2017, 06:18:16 AM »
Version 1.3.3 build 4827 (64 bit)
Win 10

Hello,

When using buildOrthomosaic() surface

does modelData use the surface from buildModel()
and does Elevation-Data use the surface from buildDem()

I have also found that Elevation-Data throws an error and ElevationData does not

The manual states;

class PhotoScan.DataSource
Data source in [PointCloudData, DenseCloudData, DepthMapsData, ModelData, TiledModelData, Elevation-Data, OrthomosaicData]

Ben

12
Python and Java API / 'PhotoScan' has no attribute 'pointCloudData'
« on: September 22, 2017, 02:29:59 AM »
Version 1.3.3 build 4827 (64 bit)
Win 10

Hello,

Could someone tell me what I have done wrong?

I am getting the following error;

Traceback (most recent call last):
2017-09-22 09:05:35   File "E:/PhotoScan_Scripts/photoscan_process_dji_p4p_ver13.py", line 182, in <module>
2017-09-22 09:05:35     chunk.buildOrthomosaic(surface=PhotoScan.DataSource.PointCloudData, blending=PhotoScan.BlendingMode.MosaicBlending, color_correction=True, fill_holes=True)
2017-09-22 09:05:35 RuntimeError: Unsupported data source


This is the offending line;
Code: [Select]
chunk.buildOrthomosaic(surface=PhotoScan.DataSource.PointCloudData, blending=PhotoScan.BlendingMode.MosaicBlending, color_correction=True, fill_holes=True)
And this is the full script;

Code: [Select]
import PhotoScan
import os

global doc

#Used to loop through folders
#Add comma delimited list of project folders below
collection = ['test_1','test_2']

for project_name in collection:

doc = PhotoScan.app.document

print('project_path')
drive = 'E'
project_path = os.path.normpath(drive + ":/" + project_name + "/" + project_name + ".psx")
path_photos = os.path.normpath(drive + ":/" + project_name + "/JPEG")
output_path = os.path.normpath(drive + ":/" + project_name + "/")

print(project_path)
print(path_photos)
print(output_path)

# Create project file
doc.save(project_path, chunks = doc.chunks )
doc.open(project_path)

# Remove Chunks if they exist (they are in the order 1 and 0 for a reason).
print('Remove chunks if exist')
if len(doc.chunks):
doc.chunk = doc.chunks[1]
chunk = doc.chunk
doc.remove(chunk)

if len(doc.chunks):
doc.chunk = doc.chunks[0]
chunk = doc.chunk
doc.remove(chunk)

print('Name the chunk for dense cloud')
chunk = PhotoScan.app.document.addChunk()
chunk.label = project_name + "_dense_cloud"

print('Add Photos')
image_list = [
os.path.join(path_photos, path)
for path in os.listdir(path_photos)
if path.lower().endswith(("jpg", "jpeg", "tif", "png","JPG","JPEG","TIF",""))
]

print(image_list)
chunk.addPhotos(image_list)

print('Load Exif')
chunk.loadReferenceExif()

print('Set COORD SYS to WGS84')
coord_system = PhotoScan.CoordinateSystem('EPSG::4326')
chunk.crs = coord_system

print('Match Photos')
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, preselection=PhotoScan.ReferencePreselection, tiepoint_limit=40000)

print('Align Cameras')
chunk.alignCameras()

print('Optimize Cameras')
chunk.optimizeCameras()

print('Build Dense Point Cloud')
#UltraQuality, HighQuality, MediumQuality, LowQuality, LowestQuality
#NoFiltering, MildFiltering, ModerateFiltering, AggressiveFiltering
chunk.buildDenseCloud(quality=PhotoScan.HighQuality, filter=PhotoScan.NoFiltering)   

print('Copy chunk for sparse cloud processing.')
chunk.copy()
doc.chunk = doc.chunks[1]
chunk = doc.chunk
chunk.label = project_name + "_sparse_cloud"

print('Return to the chunk for dense cloud processing')
doc.chunk = doc.chunks[0]
chunk = doc.chunk

#print('Classify Ground Points')
#chunk.classifyGroundPoints(max_angle=15.0, max_distance=4.0, cell_size=5.0)

#print('Export Point Cloud')
#chunk.exportPoints(output_path + "/POINT_CLOUD/" + project_name + "_pointcloud.txt", source=PhotoScan.DenseCloudData, format=PhotoScan.PointsFormatXYZ, blockw=1000, blockh=1000)

# -------------------------------------------------------------------
# Create Dense Cloud Chunk
# -------------------------------------------------------------------

'''
print('Build Model (Mesh) using dense cloud')
chunk.buildModel(surface=PhotoScan.HeightField, source=PhotoScan.DenseCloudData, face_count=PhotoScan.MediumFaceCount, interpolation=PhotoScan.EnabledInterpolation)

print('Close Holes')
chunk.model.closeHoles(level = 50)

print('Mapping Mode')
chunk.buildUV(mapping=PhotoScan.OrthophotoMapping)

print('Build Texture')
chunk.buildTexture(blending=PhotoScan.MosaicBlending, size=8192)

print('Save project')
doc.save()

#print('Export Report')
chunk.exportReport(output_path + project_name + "_dense_cloud.pdf")
'''

# -------------------------------------------------------------------
# Create Sparse Cloud Chunk
# -------------------------------------------------------------------

print('Make new chunk %_sparse_cloud active')
doc.chunk = doc.chunks[1]
chunk = doc.chunk

#print('Build Dense Point Cloud')
#We have copied the Dense Point Cloud from the Chunk above so we dont have to process it again.
#UltraQuality, HighQuality, MediumQuality, LowQuality, LowestQuality
#NoFiltering, MildFiltering, ModerateFiltering, AggressiveFiltering
#chunk.buildDenseCloud(quality=PhotoScan.HighQuality, filter=PhotoScan.NoFiltering)

print('Build Model (Mesh) using sparse cloud (pointCloudData = sparse cloud)')
chunk.buildModel(surface=PhotoScan.HeightField, source=PhotoScan.PointCloudData, face_count=PhotoScan.MediumFaceCount, interpolation=PhotoScan.EnabledInterpolation)

print('Save project')
doc.save()

print('Close Holes')
chunk.model.closeHoles(level = 50)

print('Mapping Mode')
chunk.buildUV(mapping=PhotoScan.OrthophotoMapping)

print('Build Texture')
chunk.buildTexture(blending=PhotoScan.MosaicBlending, size=8192)

print('Save project')
doc.save()

print('Build Dem using sparse cloud (PointCloudData)')
chunk.buildDem(source=PhotoScan.PointCloudData, interpolation=PhotoScan.EnabledInterpolation)

print('Export Dem to GDA94 Zone 50')
chunk.exportDem(output_path +'/DEM/'+ project_name + "_DEM_DenseCloud_NoFiltering.tif",image_format=PhotoScan.ImageFormatTIFF, projection=PhotoScan.CoordinateSystem('EPSG::28350'))

print('Export INPHO file to GDA94 Zone 50 ')
chunk.exportCameras(output_path + project_name + "_inpho_EPSG28350.prj", format=PhotoScan.CamerasFormatInpho, projection=PhotoScan.CoordinateSystem('EPSG::28350'), rotation_order=PhotoScan.RotationOrderXYZ)

print('Build Orthomosaic')
chunk.buildOrthomosaic(surface=PhotoScan.DataSource.PointCloudData, blending=PhotoScan.BlendingMode.MosaicBlending, color_correction=True, fill_holes=True)

print('Export Orthomosaic to GDA94 Zone 50')
chunk.exportOrthomosaic(output_path +'/ORTHO/'+ project_name + "_Ortho_SparseCloud_NoFiltering_EPSG28350.tif", image_format=PhotoScan.ImageFormatTIFF, projection=PhotoScan.CoordinateSystem('EPSG::28350'))

print('Export Report')
chunk.exportReport(output_path + project_name + "_sparse_cloud.pdf")

print('Save project')
doc.save()
   
The PhotoScan Python reference states the following;

class PhotoScan.DataSource
Data source in [PointCloudData, DenseCloudData, DepthMapsData, ModelData, TiledModelData, Elevation-Data, OrthomosaicData]

Regards
Ben

   


13
Python and Java API / Chunk Name
« on: September 18, 2017, 06:18:40 AM »
Hello,

Is it possible to give a chunk a name?

Ben

14
Python and Java API / Sparse Cloud
« on: September 14, 2017, 09:52:39 AM »
Hi,

How do I get this to use the sparse cloud and not the dense cloud;

Code: [Select]
chunk.buildModel(surface=PhotoScan.HeightField, source=PhotoScan.DenseCloudData, face_count=PhotoScan.MediumFaceCount, interpolation=PhotoScan.EnabledInterpolation)
Ben

15
Python and Java API / addPhotos Error
« on: September 14, 2017, 04:31:59 AM »
Hi,

PhotoScan Pro Ver 1.2.6 Build 2834

I have the following code that returns an error, can someone tell me why?


This is the error I get (in red);

2017-09-14 09:27:38 Saving project...
2017-09-14 09:27:38 saved project in 0.016 sec
2017-09-14 09:27:38 Finished processing in 0.016 sec (exit code 1)
2017-09-14 09:27:38 Loading project...
2017-09-14 09:27:38 loaded project in 0 sec
2017-09-14 09:27:39 Finished processing in 0 sec (exit code 1)
2017-09-14 09:27:39 E:\python_dev\py_test101.psz
2017-09-14 09:27:39 ['E:\\python_dev\\JPEG\\DJI_0416.JPG', 'E:\\python_dev\\JPEG\\DJI_0417.JPG', 'E:\\python_dev\\JPEG\\DJI_0418.JPG', 'E:\\python_dev\\JPEG\\DJI_0419.JPG', 'E:\\python_dev\\JPEG\\DJI_0420.JPG', 'E:\\python_dev\\JPEG\\DJI_0421.JPG', 'E:\\python_dev\\JPEG\\DJI_0422.JPG', 'E:\\python_dev\\JPEG\\DJI_0433.JPG', 'E:\\python_dev\\JPEG\\DJI_0434.JPG', 'E:\\python_dev\\JPEG\\DJI_0435.JPG', 'E:\\python_dev\\JPEG\\DJI_0436.JPG', 'E:\\python_dev\\JPEG\\DJI_0437.JPG', 'E:\\python_dev\\JPEG\\DJI_0438.JPG', 'E:\\python_dev\\JPEG\\DJI_0439.JPG', 'E:\\python_dev\\JPEG\\DJI_0446.JPG', 'E:\\python_dev\\JPEG\\DJI_0447.JPG', 'E:\\python_dev\\JPEG\\DJI_0448.JPG', 'E:\\python_dev\\JPEG\\DJI_0449.JPG', 'E:\\python_dev\\JPEG\\DJI_0450.JPG', 'E:\\python_dev\\JPEG\\DJI_0451.JPG', 'E:\\python_dev\\JPEG\\DJI_0452.JPG', 'E:\\python_dev\\JPEG\\DJI_0462.JPG', 'E:\\python_dev\\JPEG\\DJI_0463.JPG', 'E:\\python_dev\\JPEG\\DJI_0464.JPG', 'E:\\python_dev\\JPEG\\DJI_0465.JPG', 'E:\\python_dev\\JPEG\\DJI_0466.JPG', 'E:\\python_dev\\JPEG\\DJI_0467.JPG']
2017-09-14 09:27:39 Traceback (most recent call last):
2017-09-14 09:27:39   File "E:/python_dev/create_project_ver2.py", line 28, in <module>
2017-09-14 09:27:39     chunk.addPhotos(image_list)
2017-09-14 09:27:39 AttributeError: 'NoneType' object has no attribute 'addPhotos'

>>>

This is the code;

Code: [Select]
import PhotoScan
import os

global doc
doc = PhotoScan.app.document

project_path = r'E:\python_dev\py_test101.psz'
path_photos = r'E:\python_dev\JPEG'

# Create project file
doc.save(project_path, chunks = doc.chunks)
doc.open(project_path)
chunk = doc.chunk

# Add Photos
image_list = [
    os.path.join(path_photos, path)
    for path in os.listdir(path_photos)
    if path.lower().endswith(("jpg", "jpeg", "tif", "png"))
    ]

print(project_path)
print(image_list)

chunk.addPhotos(image_list)

# Save project
doc.save()

Ben

Pages: [1] 2