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.

Messages - howcanoewang

Pages: [1]
Bug Reports / Can not launch tkinter on Intel MacOS
« on: November 29, 2022, 08:54:19 AM »
to reproduce:

Code: [Select]
2022-11-29 14:53:37 Populating font family aliases took 324 ms. Replace uses of missing font family "Courier" with one that exists to avoid this cost.
2022-11-29 14:53:38 OpenGL Vendor: ATI Technologies Inc.
2022-11-29 14:53:38 OpenGL Renderer: AMD Radeon Pro 5500M OpenGL Engine
2022-11-29 14:53:38 OpenGL Version: 2.1 ATI-4.8.101
2022-11-29 14:53:38 Maximum Texture Size: 16384
2022-11-29 14:53:38 Quad Buffered Stereo: not enabled
2022-11-29 14:53:38 ARB_vertex_buffer_object: supported
2022-11-29 14:53:38 ARB_texture_non_power_of_two: supported
2022-11-29 14:53:38 Agisoft Metashape Professional Version: 1.8.4 build 14856 (64 bit)
2022-11-29 14:53:38 Platform: Mac OS
2022-11-29 14:53:38 CPU: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz (laptop)
2022-11-29 14:53:38 CPU family: 6 model: 158 signature: 906EDh
2022-11-29 14:53:38 RAM: 64.0 GB
2022-11-29 14:53:39 Using simple console. Rich console can be enabled in Preferences dialog.
>>> import tkinter
>>> tkinter._test()   # this may raise no such function error, run >>> tkinter._test, first will solve this problem
2022-11-29 14:47:40 Traceback (most recent call last):
2022-11-29 14:47:40   File "<console>", line 1, in <module>
2022-11-29 14:47:40   File "/Applications/", line 4557, in _test
2022-11-29 14:47:40     root = Tk()
2022-11-29 14:47:40   File "/Applications/", line 2272, in __init__
2022-11-29 14:47:40     self._loadtk()
2022-11-29 14:47:40   File "/Applications/", line 2288, in _loadtk
2022-11-29 14:47:40     raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)"
2022-11-29 14:47:40 RuntimeError: tk.h version (8.6) doesn't match libtk.a version (8.5)

The 1.7.6 also has the same error.

This command can run without any problem on my local python.

Dear Alexey,

Thank you for your reply, that works for me!


Hello ihabali,

Removing the lib/ should solve the problem. Others could be kept.

Dear Alexey,

Thank you for your solutions, it helped me to successfully run the bash script and saw the GUI. However, when I installed the python.whl and import Metashape in my local python environment, this problem still exists, may you help to check the reason?

The version I used is 1.8.3 pro and related whl.


Code: [Select]
crest@RTX3090AMD:~$ python3
Python 3.8.10 (default, Jun  2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Metashape
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/crest/.local/lib/python3.8/site-packages/Metashape/", line 3, in <module>
    from .Metashape import *
ImportError: /lib/x86_64-linux-gnu/ undefined symbol: __gmpn_cnd_sub_n

Hello, I am writing scripts for batch processing, but hard to find the API to modify this value. Any ideas to implement this without manually changing chunks one by one?

Thanks for your help.

Apologize, it is caused by the poor amount of tie points (4549 by high - fail;  46646 by highest - success), not caused by the duplicate image names.

Please archive or delete this post if necessary.

I am using "Foldio 360" rotation platform to take object images for 3D reconstruction,  it will rotate 10 degrees (horizontally) each time and take 36 images, and always name as follows: [01.jpg, 02.jpg, 03.jpg, ... , 36.jpg]

The camera position is always fixed, but scanned object is flipped for 45 degrees (vertically), and finally got 8 image groups:


|- rotation 0/
|   |- 01.jpg
|   |- 02.jpg
|   |- ...
|   |- 36.jpg
|- rotation 45/
|   |- 01.jpg
|   |- ...
|   |- 36.jpg
|- rotation 90/
|- rotation 135/
|- ...
|- rotation 315/

(please note, for each folder, the subimages have the same image name)

Then, I added all these images in one chunk, and grouped them by camera groups, and make masks for each image to remove the static backgrounds.

Successfully aligned photos by [highest accuracy, generic preselection, sequential reference preselection, apply mask to key points, exclude stationary tie points and adaptive camera model fitting], got expected tie points (left subimg). But build dense cloud, it produces point cloud with a missing part (right subimg), which is almost the same result from only 36 images from "rotation 90" folder.

Then I copied and rename the project folder like this, given unique image names:

|- rotation 0/
|   |- c0_01.jpg
|   |- c0_02.jpg
|   |- ...
|   |- c0_36.jpg
|- rotation 45/
|   |- c45_01.jpg
|   |- ...
|   |- c45_36.jpg
|- rotation 90/
|- rotation 135/
|- ...
|- rotation 315/

Doing the same thing like before (except ranaming image.label c0_01 -> 01 for sequential reference preselection by script in Metashape project, otherwise unable to align all images at all), and got expected dense cloud:

The only difference between two projects, is whether image names are unique or not. I personally guess it is caused by a bug in the MVS steps of building dense cloud, the duplicate image name override previous calculation results. A simple compairson:

Python and Java API / Re: Photoscan + Anaconda
« on: March 22, 2021, 05:22:43 AM »
Hello mat,

PhotoScan functionality via Python can be accessed only via PhotoScan itself, i.e. PhotoScan is not provided as external library or module.

In headless mode you can all the script execution via command line call:
Code: [Select]
photoscan.exe -r

Currently, it is now supported without Photoscan itself.

First, download and pip install Metashape...whl module in anaconda environment:

Then, set the folder of Metashape lincense file (metashape.lic) as "agisoft_LICENSE" enviromental variable
e.g. agisoft_LICENSE="D:\\...\\Agisoft\\Metashape Pro\\ "

And then restart computer, and using the following code to check whether the envorment variable be correctly set.
Code: [Select]
>>> import os
>>> os.environ['agisoft_LICENSE']
'D:\\...\\Agisoft\\Metashape Pro\\'

And then you can call the API directly:
Code: [Select]
PS C:\Users\xxx> conda activate lab
(lab) PS C:\Users\xxx> python
Python 3.7.7 (default, May  6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import Metashape

Without giving any license not found error.

And a demo for creating a metashape project:
Code: [Select]
>>> doc = Metashape.Document()
>>> chunk = doc.addChunk()
>>> path = r"E:\...\PyAPI_Test.psx"
SaveProject: path = E:/.../PyAPI_Test.psx
saved project in 0.148 sec
LoadProject: path = E:/.../PyAPI_Test.psx
loaded project in 0.021 sec

Pages: [1]