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

Pages: [1]
1
Python and Java API / How export the Date & time
« on: July 18, 2019, 12:47:43 PM »
Hello !
I would like add the date and the time to my txt export file.
Below, the script, that i use to export my markers.
I want add Date&time after the Name of markers. Some help please for the script  :-\?

Code: [Select]

import Metashape, math
FILEPATH1 = 'C:/Alexandre/PFE/7.Couloir/Les_scène_refait/PYTHON/Export_donnée/Coordo_marker.txt'#lien fichier export

#Export des Markers


doc = Metashape.app.document
chunk = doc.chunk
T = chunk.transform.matrix
f = open(FILEPATH1, 'w')


for item in chunk.markers:
   if item.position == None:
      continue
   v = item.position
   v.size = 4
   v.w = 1
   if not chunk.transform:
      chunk.transform.matrix = Metashape.Matrix.Diag( (1,1,1,1) )
   T = chunk.transform.matrix
   v_t = T * v
   v_t.size = 3
   proj = chunk.crs
   v_out = proj.project(v_t)
   f.write(item.label + ',' + str(v_out[0]) + ',' + str(v_out[1]) + ',' + str(v_out[2]) +  '\n')
f.close()



Regards !
Alex  ;)

2
Hello,
I would like export just some markers and the errors pix of them in a txt file.
I've found this code to export all markers location.

Code: [Select]
# exports all markers in activeChunk to csv.

import Metashape, math
FILEPATH = 'C:/Alexandre/PFE/Python/Resultat_export/marker_export.txt'



doc = Metashape.app.document
chunk = doc.chunk
T = chunk.transform.matrix
f = open(FILEPATH, 'w')
for item in chunk.markers:
   if item.position == None:
      continue
   v = item.position
   v.size = 4
   v.w = 1
   if not chunk.transform:
      chunk.transform.matrix = Metashape.Matrix.Diag( (1,1,1,1) )
   T = chunk.transform.matrix
   v_t = T * v
   v_t.size = 3
   proj = chunk.crs
   v_out = proj.project(v_t)
   f.write(item.label + ',' + str(v_out[0]) + ',' + str(v_out[1]) + ',' + str(v_out[2]) +  '\n')
f.close()

But how to make if I just want the markers
  • ,[1],[2], [3], [4],[5]


In addition, I would like export the error pix of each marker. Is it possible ?

Regards,
Alex

3
Hello,
I'm trying to automate my process.
I want to change the pixel_width and pixel_height in camera calibration before alignment.
The code following works without error but nothing change.

Code: [Select]
import Metashape

print(">>> Changement Taille_pixel <<<")

Metashape.Sensor.pixel_height=0.0043169
Metashape.Sensor.pixel_width=0.0043169

Some help please ?

Kind Regard,
Alex

Pages: [1]