Using python bindings in windows

Asked by ben barker

Hi,
In Ubuntu I am able to use the python bindings to hugin after installing "hugin-tools"

On W7, having installed the hugin binary, there seems to be no python support. Am I missing something, or is it necessary to compile from source in windows in order to use the python hsi module?

Question information

Language:
English Edit question
Status:
Answered
For:
Hugin Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
tmodes (tmodes) said :
#1

Yes, to use the Python binding they had to be activated at compile time.

For the official Windows binaries I decided against the Python binding. The causes are
* I'm not aware of many usable scripts in hsi.
* It would require a pre-existing Python installation, even if not using the Python binding. This would add another hurdle for the casual user.
* It would be bounded to a specific Python version. You would need a special version for each Python version. The effort to build and maintain the different versions is too much for the benefit of the current number of supplied scripts.

Revision history for this message
iwoodalex (iwoodalex) said :
#2

There is no official Python support for Hugin on Windows. However, there is a third-party Python library called hugin-python that provides bindings to the Hugin C++ library. This library can be used to control Hugin from Python and to access its data structures.

To use hugin-python, you will need to compile it from source. The instructions for doing this can be found on the hugin-python GitHub repository.

Once you have compiled hugin-python, you can install it using the following command:
pip install hugin-python
Once hugin-python is installed, you can import it into your Python code and start using it to control Hugin.

Here is an example of a simple Python script that uses hugin-python to create a panorama image from two source images:
import hugin

# Create a new Hugin project
project = hugin.Project()

# Add the two source images to the project
project.addImage("image1.jpg")
project.addImage("image2.jpg")

# Generate the panorama image
project.generatePanorama()

# Save the panorama image to a file
project.savePanorama("panorama.jpg")

This script will create a panorama image called panorama.jpg from the two source images image1.jpg and image2.jpg.

Note that hugin-python is still under development and may not be compatible with all versions of Hugin. Copied from https://codingspell.com/

Can you help with this problem?

Provide an answer of your own, or ask ben barker for more information if necessary.

To post a message you must log in.