ankitaggarwal011 / PyCNN
- воскресенье, 21 августа 2016 г. в 03:13:19
Python
Image Processing with Cellular Neural Networks in Python
Cellular Neural Networks (CNN) are a parallel computing paradigm similar to neural networks, with the difference that communication is allowed between neighboring units only. Image Processing is one of its applications. CNN processors were designed to perform image processing; specifically, the original application of CNN processors was to perform real-time ultra-high frame-rate (>10,000 frame/s) processing unachievable by digital processors.
This python library is the implementation of CNN for the application of Image Processing.
Note: The library has been cited in the research published on Using Python and Julia for Efficient Implementation of Natural Computing and Complexity Related Algorithms, look for the reference #19 in the references section. I'm glad that this library could be of help to the community.
This is an extension of a demo at 14th Cellular Nanoscale Networks and Applications (CNNA) Conference 2014. I have written a blog post, available at Image Processing in CNN with Python on Raspberry Pi.
The python (2.7.6) modules are needed in order to use this library.
PIL (Image): 1.1.7
Scipy: 0.14.1rc1
Numpy: 1.8.1
Note: The module versions mentioned are tested and expected to work. The library might work on later versions, but that hasn't been tested. If you have information regarding this, please consider adding the same here. Thanks.
Image Processing using CNN is simple using this library, just clone the repository and use the following code.
from cnnimg import cnnimg
cnn = cnnimg()
cnn.edgedetection('input.bmp', 'output1.png')
cnn.grayscaleedgedetection('input.bmp', 'output2.png')
cnn.cornerdetection('input.bmp', 'output3.png')
cnn.diagonallinedetection('input.bmp', 'output4.png')
cnn.inversion('input.bmp', 'output5.png')
cnn.generaltemplates('input.bmp', 'output6.png')
Use example.py available with the repository.
$ python example.py
Edge Detection:
Corner Detection:
Diagonal line Detection:
Inversion (Logic NOT):
Here, the input is the popular face in image processing field, Lenna.
Edge Detection:
Diagonal line Detection:
from cnnimg import cnnimg
Import the module in your main file.
cnn = cnnimg()
Initialize the cnn class
Function for edge detection using CNN on a given image.
Function for grayscale edge detection using CNN on a given image.
Function for corner detection using CNN on a given image.
Function for diagonal line detection using CNN on a given image.
Function for invert an image using CNN.
Function for applying general CNN templates on a given image.
If anybody is interested in working on developing this library, fork and feel free to get in touch with me.