An application guide in Romanian can be found here: doc/ghid_utilizare.pdf
This Platform allows you to load a color/grayscale image and apply image processing algorithms on it, showing you the result in a different panel.
You can also plot different functions based on the images. There is also a magnifier avaiable.
Image processing and plotting algorithms are easy to integrate with the app.
Install all the dependencies using the following command in a Command Prompt/Terminal in the directory you've cloned the repository in (make sure you have the path to Python in the Environment Variables - PATH):
pip install --user -r requirements.txt
Run the ImageProcessingPlatform.pyw
script using Python.
The main window can load an image from disk, show a processed image, zoom the images and save the processed image. The main window also displays your custom image processing algorithms on the top menu bar.
The platform provides a magnifier and a plotter for usage on the original image and on the processed image. After opening the magnifier/plotter, the original/processed image can be left clicked and the magnifier/plotter will update. All the markings will dissapear after closing the magnifier/plotter window.
Right clicking the original/processed image will add the click location into a queue that can be used by your algorithms as input. Those positions will also be marked in the application. This queue can be emptied using the Esc key.
Examples present in the application in PointwiseOperations.py and Thresholding.py.
Adding algorithms will be done in the folder ImageProcessingAlgorithms.
The platform will automatically import all files that do not start with _
(underscore). At the moment, the platform
does not distinguish between files and packages, so packages will be included as well. If you want
to include files from packages, do so in a __init__.py
file in your package.
In an imported file, algorithms shall be put in functions and they must be decorated with
the @RegisterAlgorithm
decorator. Functions that do not have this decorator will not be
registered by the platform. At the moment, the decorator works exclusively on functions (not on classes).
Requirements for a function to be registered correctly:
@RegisterAlgorithm
decorator@RegisterAlgorithm
decorator will receive the following 2 parameters in this order:
1) a unique name for the algorithm (string)
2) a menu or menu path in which it will reside in the UI (string)Notes on the above mentioned:
Optional parameters for the RegisterAlgorithm decorator (after the two mandatory ones):
Some algorithms require the user to provide one or more inputs. Similar to the @RegisterAlgorithm
decorator which
tells the platform what to do, there is another useful decorator called @InputDialog
. This decorator instructs the program
to show an input dialog before calling the function to get user input and pass this user input to the function.
Requirements for a function to use @InputDialog
:
@InputDialog
decorator@RegisterAlgorithm
decorator; order of decorators doesn't mater; The @InputDialog
decorator can accept any number of named parameters. Each parameter's name will be shown on a
separate line with a textbox to its right.
Notes:
Some algorithms don't produce an image, but have other results which should be displayed to the user.
In the same fashion, the platform provides the @OutputDialog
decorator. It will instruct the platform to show a text dialog
when the function returns.
Requirements for a function to use @OutputDialog
:
@OutputDialog
decorator@RegisterAlgorithm
decorator; order of decorators doesn't mater; The @OutputDialog
decorator accepts one mandatory string parameter: the dialog's title.
The displayed message will be OPTIONALLY* transmitted in the return value of the function in the following manners:
1) as the only return value: return "My message"
2) as a second value in an iterable: return image, "My message"
None, "My message"
*you can still transmit just the image if you wish so
Examples present in the platform here.
One of the ways to extract information about an image is to plot different data or functions based on the image. The platform comes with three basic algorithms in the PlottingAlgorithms package. You can add your own algorithms in this package. Same conventions apply to importing plotting algorithms (see above section): those who start with an underscore are not imported, no distinction between modules and packages etc.
Plotting algorithms will be put in functions decorated with @PlotterFunction
. It does not work on classes.
These functions will be registered by the platform and will be integrated in the UI automatically. It will be present in the
"Plot Function" drop down list in the Plotter window.
Requirements for a function to be registered correctly:
@PlotterFunction
decorator and the PlottingData
class@PlotterFunction
decorator will receive a unique name for the algorithm (string); it will be shown in the UIOptional decorator parameters:
Plotting functions are called in a lazy fashion. They are not called until they are selected in the drop-down list.
The values that you want to plot are stored in a PlottingData
object. A plotting function must return a list of
PlottingData
objects. This allows one function to have multiple plots for comparison.
Each PlottingData
object contains:
range(len(y))
(done by pyqtgraph library)The settings file can be found at Application/Settings.py. All the settings below are automatically validated by the app (you cannot input wrong settings). The application splits the settings into 3 classes:
The app throws an "Import Error: DLL load failed: The specified module could not be found" exception
This is an opencv-python issue. Read the project's FAQ here.