Data Visualization Tools Python gives a simple and powerful way to process images programmatically, and building a nice GUI can be done easily by combining Python4Delphi and scikit-image library, inside Delphi and C++Builder. Python4Delphi (P4D) is a free tool that allows you to execute Python scripts, create new Python modules and types in Delphi.
Table of Contents
What is scikit-image?
scikit-image is an image processing library that implements algorithms and utilities for use in research, education, and industry applications. It is released under the liberal Modified BSD open source license, provides a well-documented API in the Python programming language, and is developed by an active, international team of collaborators.
scikit-image aims to:
- To provide high quality, well-documented and easy-to-use implementations of common image processing algorithms.
- To facilitate education in image processing.
- To address industry challenges.
How do I load and process scientific images in my app?
This post will guide you on how to run the collections of image processing algorithms, datasets, and utilities in scikit-image library and use Python for Delphi to display it in the Delphi Windows GUI app.
First, open and run our Python GUI using project Demo1 from Python4Delphi with RAD Studio. Then insert the script into the lower Memo, click the Execute button, and get the result in the upper Memo. You can find the Demo1 source on GitHub. The behind the scene details of how Delphi manages to run your Python code in this amazing Python GUI can be found at this link.
Is there an example of using skikit-image in an app?
Let’s try a simple but stunning example to get started with scikit-image: Load scientific images examples using scikit-image using the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import matplotlib.pyplot as plt import matplotlib from skimage import data matplotlib.rcParams['font.size'] = 18 images = ('hubble_deep_field', 'immunohistochemistry', 'lily', 'microaneurysms', 'moon', 'retina', 'shepp_logan_phantom', 'skin', 'cell', 'Human_mitosis', ) for name in images: caller = getattr(data, name) image = caller() plt.figure() plt.title(name) if image.ndim == 2: plt.imshow(image, cmap=plt.cm.gray) else: plt.imshow(image) plt.show() |
Output in Python4Delphi GUI:
You will notice that the title of each image indicates the name of the function. By running the code above, the following windows will show up:
Congratulations, now you have learned how to run the collections of image processing algorithms, datasets, and utilities in scikit-image library and use Python for Delphi to display it in the Delphi Windows GUI app!
Check out the scikit-image library for Python and use it in your projects: https://pypi.org/project/scikit-image/ and
Check out Python4Delphi which easily allows you to build Python GUIs for Windows using Delphi: https://github.com/pyscripter/python4delphi