Forum

Recent Posts

Pages: [1] 2 3 ... 10
1
Hello Agisoft,

I try to following process by python script.
- Generate dense point clouds by using series of photo
- Select points of objects (such as a vehicle) which appears in a photo from dense point cloud.
- Export selected points (such as a vehicle) to file.

Is it possible to use “selectMaskedPoints” for this purpose? 

Thank you in advance for your reply.

-Michio
2
Python Scripting / Re: Reprojection Errors (script x chunk info)
« Last post by Dora on Today at 04:40:55 AM »
Hi Luiz,

It looks like the rms reprojection error in chunk info is calculated from the errors of all projections, not from point errors. To get the global rms value divide the sum of all projection errors by the total number of projections.

Code: [Select]
# Get point errors
error = math.sqrt(sum(point_errors[point_id]) / len(point_errors[point_id])

# Get rms
# at start set err_sum = 0, num = 0
err_sum += sum(point_errors[point_id])
num += len(point_errors[point_id])

rms_error = math.sqrt(err_sum / num)

From this you can also get max reprojection error from chunk info. Now this leads to another question:
I understand how to remove tie points with a maximum reprojection error above a given threshold. This makes sense for points with only 2 projections, but for those with many projections, wouldn't it make sense to remove the projections with high errors and keep the rest? There is a way to remove tie points, and to turn off cameras, but is it possible to disable some projections associated with a given camera/tie point?

Any ideas?

Cheers!
3
Python Scripting / find yaw pitch roll using camera reference
« Last post by Darshan on Today at 02:58:01 AM »
Hi

I have added the camera position information of my images which was calculated using python from the relative transformation from a different camera, now I want to calculate the estimated yaw, pitch, roll ...is it possible using meta shape python?
Thanks
Darshan
4
Python Scripting / Re: Align Thermal images.
« Last post by Aravinth on December 10, 2019, 10:17:33 PM »
Hello Alexey,
 
I have the GCP and its projections on multiple images. I don't have proper coding knowledge to do that. So what actually I have to do in this situation to project the GCP.
5
Python Scripting / Re: Images are not visble after alignment
« Last post by Aravinth on December 10, 2019, 10:11:18 PM »
Hello Alexey,
 
The console shows the image alignment process completely. The points are deducted and the alignment is done in the console but the images are not visible.


6
Python Scripting / Re: Align Thermal images.
« Last post by Alexey Pasumansky on December 10, 2019, 10:07:23 PM »
Hello Aravinth,

To place the GCPs you need to have the data related to the GCP label and its projections on the multiple photos (in any readable format) in order to assign them to the corresponding cameras.
7
Python Scripting / Re: Images are not visble after alignment
« Last post by Alexey Pasumansky on December 10, 2019, 10:04:47 PM »
Hello Aravinth,

Do you mean that even chunk.addPhotos() doesn't work in your code?

Are there any error messages in the Console pane when you run this script? I can suggest to debugging purposes to print out the paths that you are trying to load as images. Probably, using the absolute paths would solve the problem.
8
Python Scripting / Images are not visble after alignment
« Last post by Aravinth on December 10, 2019, 09:48:10 PM »
Hello,
          I have used the below code to align the thermal images the console shows the process but the images are not shown in the workspace and in the reference tab. Kindly help me.
 
Code: [Select]

import glob
try:
    import Metashape as env
    doc = Metashape.app.document
    env_type = 1
except:
    import PhotoScan as env
    doc = PhotoScan.app.document
    env_type = 2
   
load_images = True
load_thermal = True
# Thermal data
path_calib = 'C:\\Program Files\\Agisoft\\Metashape Pro'
path_images = 'C:\\Program Files\\Agisoft\Metashape Pro\\flir'
path_subdir = 'flir\\'
fileext = '*.tiff'
chunk_name = 'FLIR'
calib_fname = 'xt2_flir_20190206.xml'
flength = 13
psize = 0.017

ch = env.app.document.addChunk()
ch.label = chunk_name

# initiate images list
imgList = []
imgListNames = []
# construct flight directory
dir_srs = path_subdir
# reset file counter
cnt = 0

# go over all images
for filename in glob.glob(dir_srs + fileext):
# add image to list
    imgList.append(filename)
    fname = filename.split('\\')
    # add file name
    imgListNames.append(fname[-1])
    #' increment counter
    cnt += 1
   
if load_images == 1:
    # add images to chunk
    ch.addPhotos(imgList)
# create calibration instance
calibData = env.Calibration()
# load calibration data from file
calibData.load(calib_fname, format="xml")
# load camera calibration params
ch.sensors[0].user_calib = calibData
# assign camera focal length
ch.sensors[0].focal_length = flength
# assign camera pixel size
ch.sensors[0].pixel_size = env.Vector([psize,psize])
# do not optimise camera intrinsics
if env_type == 1:
    ch.sensors[0].fixed_calibration = True
else:
    ch.sensors[0].fixed = True

# ch = Metashape.app.document.chunk
path = '20191024_gcp_coordinates.txt'
ch.loadReference(path, format = Metashape.ReferenceFormatCSV, delimiter=",", columns="nxyz")

for frame in ch.frames:
    frame.matchPhotos(accuracy=Metashape.HighestAccuracy, generic_preselection=True,reference_preselection=True)

# ch.matchPhotos(accuracy=Metashape.LowAccuracy, generic_preselection=True,reference_preselection=True)
ch.alignCameras()
# ch.buildDepthMaps(quality=Metashape.MediumQuality, filter=Metashape.AggressiveFiltering)
# ch.buildDenseCloud()
# ch.buildModel(surface=Metashape.Arbitrary, interpolation=Metashape.EnabledInterpolation)
# ch.buildUV(mapping=Metashape.GenericMapping)
# ch.buildTexture(blending=Metashape.MosaicBlending, size=4096)
#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)

9
Python Scripting / Align Thermal images.
« Last post by Aravinth on December 10, 2019, 09:43:12 PM »
Hello,
         Currently, I am working with UAV thermal images and I have to the following steps in python scripting.
 
1.Load thermal images
2.Load calibration data
3.Load GCP's
4.Select-control points
5. Do alignment
6. Get extrinsic parameters
7.Project GCP's
8. Get errors.

I think I have done till alignment but I am not sure, How to proceed after alignment. I have attached my script with this. Kindly help me.


Code: [Select]

import glob
try:
    import Metashape as env
    doc = Metashape.app.document
    env_type = 1
except:
    import PhotoScan as env
    doc = PhotoScan.app.document
    env_type = 2
   
load_images = True
load_thermal = True
# Thermal data
path_calib = 'C:\\Program Files\\Agisoft\\Metashape Pro'
path_images = 'C:\\Program Files\\Agisoft\Metashape Pro\\flir'
path_subdir = 'flir\\'
fileext = '*.tiff'
chunk_name = 'FLIR'
calib_fname = 'xt2_flir_20190206.xml'
flength = 13
psize = 0.017

ch = env.app.document.addChunk()
ch.label = chunk_name

# initiate images list
imgList = []
imgListNames = []
# construct flight directory
dir_srs = path_subdir
# reset file counter
cnt = 0

# go over all images
for filename in glob.glob(dir_srs + fileext):
# add image to list
    imgList.append(filename)
    fname = filename.split('\\')
    # add file name
    imgListNames.append(fname[-1])
    #' increment counter
    cnt += 1
   
if load_images == 1:
    # add images to chunk
    ch.addPhotos(imgList)
# create calibration instance
calibData = env.Calibration()
# load calibration data from file
calibData.load(calib_fname, format="xml")
# load camera calibration params
ch.sensors[0].user_calib = calibData
# assign camera focal length
ch.sensors[0].focal_length = flength
# assign camera pixel size
ch.sensors[0].pixel_size = env.Vector([psize,psize])
# do not optimise camera intrinsics
if env_type == 1:
    ch.sensors[0].fixed_calibration = True
else:
    ch.sensors[0].fixed = True

# ch = Metashape.app.document.chunk
path = '20191024_gcp_coordinates.txt'
ch.loadReference(path, format = Metashape.ReferenceFormatCSV, delimiter=",", columns="nxyz")

for frame in ch.frames:
    frame.matchPhotos(accuracy=Metashape.HighestAccuracy, generic_preselection=True,reference_preselection=True)

# ch.matchPhotos(accuracy=Metashape.LowAccuracy, generic_preselection=True,reference_preselection=True)
ch.alignCameras()
# ch.buildDepthMaps(quality=Metashape.MediumQuality, filter=Metashape.AggressiveFiltering)
# ch.buildDenseCloud()
# ch.buildModel(surface=Metashape.Arbitrary, interpolation=Metashape.EnabledInterpolation)
# ch.buildUV(mapping=Metashape.GenericMapping)
# ch.buildTexture(blending=Metashape.MosaicBlending, size=4096)
#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)


10
General / Import transformation matrix from CloudCompare
« Last post by jnb on December 10, 2019, 09:19:00 PM »
Hello,

I am looking for a way to import a transformation matrix from CloudCompare (or Geomagic / 3dReshaper) into Metashape for an entire chunk.

Somebody have an idea ?

Thank you
Pages: [1] 2 3 ... 10