Image Analysis Tool using PyQtGraph
In this article we will see how we can perform common image analysis using PyQtGraph module in Python. PyQtGraph is a graphics and user interface library for Python that provides functionality commonly required in designing and science applications. Its primary goals are to provide fast, interactive graphics for displaying data (plots, video, etc.) and second is to provide tools to aid in rapid application development (for example, property trees such as used in Qt Designer).
In order to install the PyQtGraph we use the command given below.
pip install pyqtgraph
Image analysis is the extraction of meaningful information from images; mainly from digital images by means of digital image processing techniques. Image analysis tasks can be as simple as reading bar coded tags or as sophisticated as identifying a person from their face.
In order to do this we have to do the following.
- Import the required libraries like pyqtgraph, pyqt5 and numpy.
- Create a main window class using pyqt5.
- Create a graphic window to add the widgets required to show the image analysis.
- Create two plot area and add a image item to it with the roi object to first plot area.
- Create an isocurve object and add it to the image item.
- Create a data for image and add it to the image item.
- Connect a update method to the roi object when the region is changed, inside the update method get the region and set it to the second plot area.
- Create a mouse move event and set the position, pixel value to the title according to the mouse position.
- Add this graph window to the main window layout with any additional widgets.
Below is the implementation