for those who want to apply denoise filter to opencv images (using cv2.ImRead and therefore classical image format), i wrote some routines which could interest you.
The base routines are from Nvidia Cuda SDK example (many thanks Nvidia). I changed code to not use Tex2D and just use 3D arrays from cv2.imread (colour image) or 1D array for mono images.
There are 4 files :
- KNN denoise filter for colour image
- KNN denoise filter for monochrome image
- Fast NLM denoise filter for colour image
- Fast NLM denoise filter for monochrome image
For each program, i compare OpenCV routine (cv2.fastNlMeansDenoisingColored or cv2.fastNlMeansDenoising) to PyCuda/Cuda routine.
You can find the files here :
I made some speed tests comparisons between OpenCV and PyCuda for colour images :
1544*1040 pixels image :
- OpenCV FastNLMDenoise : 0.92 seconds
- fast NLM PyCuda : 0.17 seconds
- KNN PyCuda : 0.068 seconds
3096*2080 pixels image :
- OpenCV FastNLMDenoise : 2.6 seconds
- fast NLM PyCuda : 0.67 seconds
- KNN PyCuda : 0.25 seconds
That’s a really good improvement.
I would like to thanks again Nvidia for their work, their support and for having provided me for free a Jetson Nano to support my project (related to astronomy imaging).
If you find some improvements to those routines, i am very interested in.