Journal of Real-Time Image Processing

, Volume 16, Issue 6, pp 2027–2041 | Cite as

Fast computation of 2D and 3D Legendre moments using multi-core CPUs and GPU parallel architectures

  • Khalid M. HosnyEmail author
  • Ahmad Salah
  • Hassan I. Saleh
  • Mahmoud Sayed
Original Research Paper


Legendre moments and their invariants for 2D and 3D image/objects are widely used in image processing, computer vision, and pattern recognition applications. Reconstruction of digital images by nature required higher-order moments to get high-quality reconstructed images. Different applications such as classification of bacterial contamination images utilize high-order moments for feature extraction phase. For big size images and 3D objects, Legendre moments computation is very time-consuming and compute-intensive. This problem limits the use of Legendre moments and makes them impractical for real-time applications. Multi-core CPUs and GPUs are powerful processing parallel architectures. In this paper, new parallel algorithms are proposed to speed up the process of exact Legendre moments computation for 2D and 3D image/objects. These algorithms utilize multi-core CPUs and GPUs parallel architectures where each pixel/voxel of the input digital image/object can be handled independently. A detailed profile analysis is presented where the weight of each part of the entire computational process is evaluated. In addition, we contributed to the parallel 2D/3D Legendre moments by: (1) a modification of the traditional exact Legendre moment algorithm to better fit the parallel architectures, (2) we present the first parallel CPU implementation of Legendre moment, and (3) we present the first parallel CPU and GPU acceleration of the reconstruction phase of the Legendre moments. A set of numerical experiments with different gray-level images are performed. The obtained results clearly show a very close to optimal parallel gain. The extreme reduction in execution times, especially for 8-core CPUs and GPUs, makes the parallel exact 2D/3D Legendre moments suitable for real-time applications.


Legendre moments Multi-core CPUs GPUs Image reconstructions Profile analysis Parallel algorithms Image classification 


  1. 1.
    Flusser, J., Suk, T., Zitov, B.: Moments and Moment Invariants in Pattern Recognition. Wiley, Chichester (2009)CrossRefGoogle Scholar
  2. 2.
    Talenti, G.: Recovering a function from a finite number of moments. Inverse Probl. 3, 501–517 (1987)MathSciNetCrossRefGoogle Scholar
  3. 3.
    Pawlak M.: Image analysis by moments: reconstruction and computational aspects. Oficyna Wydawnicza Politechniki Wroclawskiej. 38–42 (2006)Google Scholar
  4. 4.
    Shin, HC., et al.: Interleaved text/image deep mining on a very large-scale radiology database. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1090–1099 (2015)Google Scholar
  5. 5.
    Toharia, P., et al.: Shot boundary detection using Zernike moments in multi-GPU multi-CPU architectures. J. Parallel Distrib. Comput. 72(9), 1127–1133 (2012)CrossRefGoogle Scholar
  6. 6.
    Dongfeng, X., et al.: Parallel computation for discrete orthogonal moments of images using graphic processing unit. J. Inf. Comput. Sci. 9(3), 611–618 (2012)Google Scholar
  7. 7.
    Heidari, H., Chalechale, A., Mohammad abadi, A.A.: Parallel implementation of color based image retrieval using CUDA on the GPU. Int. J. Inf. Technol. Comput. Sci. 6(1), 33 (2013)Google Scholar
  8. 8.
    Teodoro, G., et al. High-throughput analysis of large microscopy image datasets on CPU–GPU cluster platforms. In: 2013 IEEE 27th International Symposium on Parallel Distributed Processing (IPDPS). IEEE (2013)Google Scholar
  9. 9.
    Martin-Requena, M.J., Ujaldon, M.: High performance computation of moments for an accurate classification of bone tissue images. In: 2011 IEEE 13th International Conference on High Performance Computing and Communications (HPCC). IEEE (2011)Google Scholar
  10. 10.
    Mustapha, H., Dimitrakopoulos, R.: HOSIM: a high-order stochastic simulation algorithm for generating three-dimensional complex geological patterns. Comput. Geosci. 37(9), 1242–1253 (2011)CrossRefGoogle Scholar
  11. 11.
    Srinivasa Rao, C.H.S., Kumar, S.S., Mohan, B.C.: Content based image retrieval using exact legendre moments and support vector machine. Int. J. Multimed. Appl. 2(2), 69–79 (2010)Google Scholar
  12. 12.
    Hosny, K.M.: Robust template matching using orthogonal Legendre moment invariants. J. Comput. Sci. 6(10), 1080–1084 (2010)CrossRefGoogle Scholar
  13. 13.
    Wojak, J., Angelini, E.D., Bloch, I.: Introducing Shape Constraint via Legendre Moments in a Variational Framework for Cardiac Segmentation on Non-contrast CT Images, pp. 209–214. VISAPP, Angers (2010)Google Scholar
  14. 14.
    Nakib, A., Schulze, Y., Petit, E.: Image thresholding framework based on two-dimensional digital fractional integration and Legendre moments. IET Image Process. 6(8), 717–727 (2012)MathSciNetCrossRefGoogle Scholar
  15. 15.
    Dahdouha, S., Angelinia, E.D., Grangéb, G., Blocha, I.: Segmentation of embryonic and fetal 3D ultrasound images based on pixel intensity distributions and shape priors. Med. Image Anal. 24(1), 255–268 (2015)CrossRefGoogle Scholar
  16. 16.
    Vijayalakshmi, B., Bharathi, V.S.: Classification of CT liver images using local binary pattern with Legendre moments. Curr. Sci. 110(4), 687–691 (2016)CrossRefGoogle Scholar
  17. 17.
    Hosny, K. M., Papakostas, G. A., Koulouriotis, D. E.: Accurate reconstruction of noisy medical images using orthogonal moments. In: 18th International Conference on Digital Signal Processing (DSP), (2013)Google Scholar
  18. 18.
    Sastry, S.S., Mallika, K., Rao, B.G.S., Ha, S.T., Lakshminarayana, S.: Novel approach to study liquid crystal phase transitions using Legendre moments. Phase Transit. 85(8), 735–749 (2012)CrossRefGoogle Scholar
  19. 19.
    Hosny, K.M.: Exact Legendre moment computation for gray level images. Pattern Recognit. 40(12), 3597–3605 (2007)CrossRefGoogle Scholar
  20. 20.
    Papakostas, G.A., Karakasis, E.G., Koulouriotis, D.E.: Accurate and speedy computation of image Legendre moments for computer vision applications. Image Vis. Comput. 29(3), 414–423 (2010)CrossRefGoogle Scholar
  21. 21.
    Hosny, K.M.: Fast and low-complexity method for exact computation of 3D Legendre moments. Pattern Recognit. Lett. 32(9), 1305–1314 (2011)CrossRefGoogle Scholar
  22. 22.
    Bahaoui, Z., Zenkouar, K., Fadili, H., Qjidaa, H., Zarghili A.: Blocking artifact removal using partial overlapping based on exact Legendre moments computation. J. Real Time Image Process. 1–19 (2014). doi: 10.1007/s11554-014-0465-3 CrossRefGoogle Scholar
  23. 23.
    Lachiondo, J.A., Ujaldóna, M., Berrettab, R., Moscatob, P.: Legendre moments as high performance bone biomarkers: computational methods and GPU acceleration. Comput. Methods Biomech. Biomed. Eng. Imaging Vis. 4(3-4), 146–163 (2016)CrossRefGoogle Scholar
  24. 24.
    Hosny, K.M.: New set of rotationally Legendre moment invariants. Int. J. Electr. Electron. Eng. 4, 176–180 (2010)Google Scholar
  25. 25.
    Hosny, K.M.: Refined translation and scale Legendre moment invariants. Pattern Recognit. Lett. 31(7), 533–538 (2010)CrossRefGoogle Scholar
  26. 26.
    Zhang, H., Shu, H., Coatrieux, G., Zhu, J., Wu, Q.M.J., Zhang, Y., Zhu, H., Luo, L.: Affine Legendre moment invariants for image watermarking robust to geometric distortions. IEEE Trans. Image Process. 20(8), 2189–2199 (2011)MathSciNetCrossRefGoogle Scholar
  27. 27.
    Spiegel, M.R.: Schaum’s Handbook of Formulas and Tables. MacGraw Hill, New York (1968)Google Scholar
  28. 28.
    Bossen, D.C., Kitamorn, A., Reick, K.F., et al.: Fault-tolerant design of the IBM Series 690 system using POWER4 processor technology. IBM J. Res. Dev. 46(1), 77–86 (2002)CrossRefGoogle Scholar
  29. 29.
    Vajda, A.: Multi-core and Many-core Processor Architectures, pp. 9–43. Springer, Berlin (2011)Google Scholar
  30. 30.
    Dagum, L., Menon, R.: OpenMP: an industry standard API for shared-memory programming. IEEE Comput. Sci. Eng. 5(1), 46–55 (1998)CrossRefGoogle Scholar
  31. 31.
    Wen-Mei, W.H.: GPU Computing Gems, Emerald edn, pp. 5–10. Elsevier, Amsterdam (2011)Google Scholar
  32. 32.
    Zhu, X., et al.: Parallel implementation of MAFFT on CUDA-enabled graphics hardware. IEEE/ACM Trans. Comput. Biol. Bioinform. (TCBB) 12(1), 205–218 (2015)CrossRefGoogle Scholar
  33. 33.
    Hosny, K.M.: Fast computation of accurate Zernike moments. J. Real Time Image Process. 3(1), 97–107 (2008)MathSciNetCrossRefGoogle Scholar
  34. 34.
    Hosny, K.M.: New set of Gegenbauer moment invariants for pattern recognition applications. Arab. J. Sci. Eng. 39, 7097–7107 (2014)CrossRefGoogle Scholar
  35. 35. (2016). Accessed 13 Dec 2016
  36. 36.
    Lazebnik, S., Schmid, C., Ponce, J.: Semi-local affine parts for object recognition. In: Proceedings of the British Machine Vision Conference, vol. 2, pp. 959–968, (2004)Google Scholar

Copyright information

© Springer-Verlag GmbH Germany 2017

Authors and Affiliations

  • Khalid M. Hosny
    • 1
    Email author
  • Ahmad Salah
    • 2
  • Hassan I. Saleh
    • 3
  • Mahmoud Sayed
    • 3
  1. 1.Department of Information Technology, Faculty of Computers and InformaticsZagazig UniversityZagazigEgypt
  2. 2.Department of Computer Science, Faculty of Computers and InformaticsZagazig UniversityZagazigEgypt
  3. 3.Department of Radiation EngineeringEgyptian Atomic Energy AuthorityCairoEgypt

Personalised recommendations