Using SSIM ( Structural Similarity Index ) in Xojo

Hello Everyone,

I would like to compare two images. I understand that Structural Similarity Index is one of the method to compare two images. I also understand that the Scikit Module made for python has a SSIM library.

Can anyone please guide me as to how I can use a Scikit Module of python with Xojo or if there is any other way by which I can use the SSIM algorithm in Python.

I would like to clarify that I don’t understand Python and I also don’t know the SSIM algorithm.

I would like to ask @Björn_Eiríksson if the Einhugur Plugin can be used to run the Scikit Module of Python and if so, can you please guide me on it.



Calling Python code from Xojo was discussed a couple of times here in the forum. Without knowing at least a bit of Python you won’t have fun.

You didn’t mention for which platform you need the code. macOS comes with the very old Python 2.7. If Scikit is only available for Python 3 then you need to install Python. Or you need to make an app out of Scikit. Which is not as easy as it sounds. There are several options available.

And then you can use the shell to call the executable of the Python app.

Hello @Beatrix_Willius,

Thanks for the reply.

I agree Python has been discussed a couple of times before. In fact I myself had posted a few questions before. :grinning: Yet somehow I am unable to get over all of the excitement all around that speaks of Python, especially when it comes to AI. Everyone says Python is too easy to understand, but personally I was never able to logically understand it. I was able to grasp the basic working of Xojo to a large extent in like 3 months, but Python scares me.

I shall be using Windows OS for the same. I think publishing a python code from Xojo and then interactively working with it through Shell only seems to be the way.

Python is awful compared to Xojo. The syntax, the whitespace, everything is just awful. And I spent a lot of time with Python.

1 Like

I’ve never used it but Einhuger have a Python plugin for Xojo.

I am so looking forward to using Einhuger Python Module.

But I am unable to get sufficient documentation on how to use the same.

I have downloaded the demo of Einhuger plugin, but I don’t understand to which example I should refer to use for the above example.

@Björn_Eiríksson Can you please assist.

While it is It is technically possible to load complex external packages when using the Python Plugins for Xojo then its not easy and there is no guaranty that all of them would work.

Users have successfully loaded some scientific packages. But I imagine it requires good Python skills. (And that part I cannot help you with since I got none).

Also there is the practicality to consider of what you are attempting, if you get that library to load somehow, then there is no way you can pass complex Object like Xojo Picture back and forth to Python. So your only chance then of passing it would be file paths to images and temp images on drive.

(It is also possible to load up pre set up Python instance that has the packages pre-installed, like Anaconda Python for example)

Are you allowed to use other mutual information algorithms? R has at least one package to do so, and I believe (but I have never done it myself) running R scritps from the commandline should not be difficult.

Here is the link to the R package: I have never used it myself, so I don’t know if it can do what you need.


EDIT: you will need to install R on the target computer

It looks like someone implemented the SSIM in R:

Maybe I should have said that R is a free software for statistics, and it can be programmed. There are many additional packages/libraries for R, like the SSIM package. Also, check R’s license before you commit to it: