patchIT: A Multipurpose Patch Creation Tool for Image Processing Applications
Abstract
:1. Introduction
- Extract patches both in sliding and random mode controlled by user-defined parameters regarding the patch size, stride, and distribution along the source image;
- Export the patches either directly to image files of various types, in a compact representation as MATLAB .mat files, or as raw text files that can be easily loaded and edited for further processing and maintenance;
- Involve masking techniques that act as spatial filters, identifying candidate patch areas;
- Apply patch-level geometric transformations;
- Reorder the patch intensities by user-defined patch value indexing, offering deeper low-level information insights.
2. Basic Operations
2.1. Patch Creation
2.1.1. Sliding Mode
2.1.2. Random Mode
2.2. Saving Patches
2.2.1. Image Files
2.2.2. MATLAB .Mat File
2.2.3. Raw Text Files
2.3. Patch Order
3. Further Operations and Functionality
3.1. Masking Image Regions
3.2. Patch Indexing and Geometric Transformations
3.3. Processing Modes
4. Experimental Results of a Use Case in Cartographic Research
5. Discussion
6. Conclusions
Supplementary Materials
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Dabov, K.; Foi, A.; Katkovnik, V.; Egiazarian, K. Image Denoising by Sparse 3-D Transform-Domain Collaborative Filtering. IEEE Trans. Image Process. 2007, 16, 2080–2095. [Google Scholar] [CrossRef] [PubMed]
- Qian, Y.; Shen, Y.; Ye, M.; Wang, Q. 3-D Nonlocal Means Filter with Noise Estimation for Hyperspectral Imagery Denoising. In International Geoscience and Remote Sensing Symposium (IGARSS); IEEE: Munich, Germany, 2012; pp. 1345–1348. [Google Scholar] [CrossRef]
- Papyan, V.; Elad, M. Multi-Scale Patch-Based Image Restoration. IEEE Trans. Image Process. 2016, 25, 249–261. [Google Scholar] [CrossRef]
- Liu, B.; Du, S.; Du, S.; Zhang, X. Incorporating Deep Features into GEOBIA Paradigm for Remote Sensing Imagery Classification: A Patch-Based Approach. Remote Sens. 2020, 12, 3007. [Google Scholar] [CrossRef]
- Sharma, A.; Liu, X.; Yang, X. Land Cover Classification from Multi-Temporal, Multi-Spectral Remotely Sensed Imagery Using Patch-Based Recurrent Neural Networks. Neural Netw. 2018, 105, 346–355. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Liu, Y.; Ren, Q.; Geng, J.; Ding, M.; Li, J. Efficient Patch-Wise Semantic Segmentation for Large-Scale Remote Sensing Images. Sensors 2018, 18, 3232. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Song, H.; Kim, Y.; Kim, Y. A Patch-Based Light Convolutional Neural Network for Land-Cover Mapping Using Landsat-8 Images. Remote Sens. 2019, 11, 114. [Google Scholar] [CrossRef] [Green Version]
- Cordier, N.; Delingette, H.; Ayache, N. A Patch-Based Approach for the Segmentation of Pathologies: Application to Glioma Labelling. IEEE Trans. Med. Imaging 2016, 35, 1066–1076. [Google Scholar] [CrossRef] [Green Version]
- Khawaja, A.; Khan, T.M.; Naveed, K.; Naqvi, S.S.; Rehman, N.U.; Junaid Nawaz, S. An Improved Retinal Vessel Segmentation Framework Using Frangi Filter Coupled with the Probabilistic Patch Based Denoiser. IEEE Access 2019, 7, 164344–164361. [Google Scholar] [CrossRef]
- Bustin, A.; Lima da Cruz, G.; Jaubert, O.; Lopez, K.; Botnar, R.M.; Prieto, C. High-Dimensionality Undersampled Patch-Based Reconstruction (HD-PROST) for Accelerated Multi-Contrast MRI. Magn. Reson. Med. 2019, 81, 3705–3719. [Google Scholar] [CrossRef]
- Bernal, J.; Kushibar, K.; Cabezas, M.; Valverde, S.; Oliver, A.; Llado, X. Quantitative Analysis of Patch-Based Fully Convolutional Neural Networks for Tissue Segmentation on Brain Magnetic Resonance Imaging. IEEE Access 2019, 7, 89986–90002. [Google Scholar] [CrossRef]
- Manjón, J.V.; Coupe, P. MRI Denoising Using Deep Learning. In Lecture Notes in Computer Science (Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics); Springer: Cham, Switzerland, 2018; pp. 12–19. [Google Scholar] [CrossRef]
- Nasor, M.; Obaid, W. Detection and Localization of Early-Stage Multiple Brain Tumors Using a Hybrid Technique of Patch-Based Processing, k-Means Clustering and Object Counting. Int. J. Biomed. Imaging 2020, 2020, 1–8. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Pérez-García, F.; Sparks, R.; Ourselin, S. TorchIO: A Python Library for Efficient Loading, Preprocessing, Augmentation and Patch-Based Sampling of Medical Images in Deep Learning. Comput. Methods Programs Biomed. 2021, 208, 106236. [Google Scholar] [CrossRef] [PubMed]
- Barnes, C.; Zhang, F.L. A Survey of the State-of-the-Art in Patch-Based Synthesis. Comput. Vis. Media 2017, 3, 3–20. [Google Scholar] [CrossRef] [Green Version]
- Zhang, R.; Yi, X.; Li, H.; Liu, L.; Lu, G.; Chen, Y.; Guo, X. Multiresolution Patch-Based Dense Reconstruction Integrating Multiview Images and Laser Point Cloud. Int. Arch. Photogramm. Remote Sens. Spat. Inf. Sci. 2022, XLIII-B2-2, 153–159. [Google Scholar] [CrossRef]
- Shen, S. Accurate Multiple View 3D Reconstruction Using Patch-Based Stereo for Large-Scale Scenes. IEEE Trans. Image Process. 2013, 22, 1901–1914. [Google Scholar] [CrossRef]
- Minoura, H.; Yonetani, R.; Nishimura, M.; Ushiku, Y. Crowd Density Forecasting by Modeling Patch-Based Dynamics. IEEE Robot. Autom. Lett. 2021, 6, 287–294. [Google Scholar] [CrossRef]
- Kentsch, S.; Caceres, M.L.L.; Serrano, D.; Roure, F.; Diez, Y. Computer Vision and Deep Learning Techniques for the Analysis of Drone-Acquired Forest Images, a Transfer Learning Study. Remote Sens. 2020, 12, 1287. [Google Scholar] [CrossRef] [Green Version]
- Mirzaalian, H.; Hussein, M.; Abd-Almageed, W. On the Effectiveness of Laser Speckle Contrast Imaging and Deep Neural Networks for Detecting Known and Unknown Fingerprint Presentation Attacks. In Proceedings of the 2019 International Conference on Biometrics (ICB), Crete, Greece, 4–7 June 2019. [Google Scholar] [CrossRef]
- MacEachren, A.M. Map Complexity: Comparison and Measurement. Am. Cartogr. 1982, 9, 31–46. [Google Scholar] [CrossRef]
- Fairbairn, D. Measuring Map Complexity. Cartogr. J. 2006, 43, 224–238. [Google Scholar] [CrossRef]
- Schnur, S.; Bektaş, K.; Çöltekin, A. Measured and Perceived Visual Complexity: A Comparative Study among Three Online Map Providers. Cartogr. Geogr. Inf. Sci. 2017, 45, 238–254. [Google Scholar] [CrossRef]
- Liao, H.; Wang, X.; Dong, W.; Meng, L. Measuring the Influence of Map Label Density on Perceived Complexity: A User Study Using Eye Tracking. Cartogr. Geogr. Inf. Sci. 2018, 46, 210–227. [Google Scholar] [CrossRef]
- Tzelepis, N.; Kaliakouda, A.; Krassanakis, V.; Misthos, L.M.; Nakos, B. Evaluating the Perceived Visual Complexity of Multidirectional Hill-Shading. Geod. Cartogr. 2020, 69, 161–172. [Google Scholar]
- Keil, J.; Edler, D.; Kuchinke, L.; Dickmann, F. Effects of Visual Map Complexity on the Attentional Processing of Landmarks. PLoS ONE 2020, 15, e0229575. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Merlemis, N.; Kesidis, A.; Misthos, L.-M.; Zekou, E.; Drakaki, E.; Krassanakis, V. Quantifying Visual Heterogeneity of Paper Maps Using Diffuse Reflectance Spectroscopy. Abstr. ICA 2022, 5, 1–2. [Google Scholar] [CrossRef]
- Kesidis, A.L.; Krassanakis, V.; Merlemis, N.; Misthos, L.-M. A Multipurpose Patch Creation Tool for Efficient Exploration of Digital Cartographic Products. Abstr. ICA 2022, 5, 1–2. [Google Scholar] [CrossRef]
- Haining, R. Spatial Data Analysis: Theory and Practice. Spat. Data Anal. 2003. [Google Scholar] [CrossRef]
- Delmelle, E.M. Spatial Sampling. Handb. Reg. Sci. 2014, 1385–1399. [Google Scholar] [CrossRef]
- Haining, R.P. Spatial Sampling. Int. Encycl. Soc. Behav. Sci. 2001, 14822–14827. [Google Scholar] [CrossRef]
- Brus, D.J.; Knotters, M. Sampling Design for Compliance Monitoring of Surface Water Quality: A Case Study in a Polder Area. Water Resour Res 2008, 44. [Google Scholar] [CrossRef] [Green Version]
- Wang, J.F.; Stein, A.; Gao, B.B.; Ge, Y. A Review of Spatial Sampling. Spat Stat 2012, 2, 1–14. [Google Scholar] [CrossRef]
- Li, J.; Tian, L.; Wang, Y.; Jin, S.; Li, T.; Hou, X. Optimal Sampling Strategy of Water Quality Monitoring at High Dynamic Lakes: A Remote Sensing and Spatial Simulated Annealing Integrated Approach. Sci. Total Environ. 2021, 777, 146113. [Google Scholar] [CrossRef]
- Fan, L.; Zhang, F.; Fan, H.; Zhang, C. Brief Review of Image Denoising Techniques. Vis. Comput. Ind. 2019, 2, 7. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Buades, A.; Coll, B.; Morel, J.M. A Non-Local Algorithm for Image Denoising. In Proceedings of the 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, CVPR 2005, San Diego, CA, USA, 20–25 June 2005; Volume II, pp. 60–65. [Google Scholar] [CrossRef]
- Alkinani, M.H.; El-Sakka, M.R. Patch-Based Models and Algorithms for Image Denoising: A Comparative Review between Patch-Based Images Denoising Methods for Additive Noise Reduction. EURASIP J. Image Video Process. 2017, 2017, 58. [Google Scholar] [CrossRef] [PubMed]
Stride | (128,128) | 16 | 16 | 16 | 480 | 510 | 510 |
(64,64) | 49 | 64 | 64 | 1888 | 2040 | 2040 | |
(16,16) | 625 | 961 | 1024 | 29,824 | 32,026 | 32,400 | |
(4,4) | 9409 | 14,641 | 16,129 | 472,861 | 507,949 | 516,901 | |
(1,1) | 148,225 | 231,361 | 255,025 | 7,548,529 | 8,109,361 | 8,252,449 |
Stride | (128,128) | 0.250 | 0.016 | 0.001 | 7.500 | 0.498 | 0.031 |
(64,64) | 0.766 | 0.062 | 0.004 | 29.500 | 1.992 | 0.125 | |
(16,16) | 9.766 | 0.938 | 0.062 | 466.000 | 31.275 | 1.978 | |
(4,4) | 147.016 | 14.298 | 0.984 | 7388.453 | 496.044 | 31.549 | |
(1,1) | 2316.016 | 225.938 | 15.565 | 11,7945.766 | 7919.298 | 503.690 |
Saving Mode | Description | Example |
---|---|---|
images | Saves patches into separate image files | patchit(‘image.jpg’,[128 128],… ‘Stride’,[64 64],’SaveMode’,’images’,… ‘SaveImagesTemplate’,’C:\results\patchfile000.png’); Creates PNG patch files with dimensions of 128 × 128 in folder C:\results using the filename template patchfile000 as ‘C:\results\patchfile001.png’ ‘C:\results\patchfile002.png’ … (etc) … |
mat | Saves all patches into a multidimensional variable | patchit(‘image.jpg’,[32 32],… ‘Stride’,[4 4],’SaveMode’,’mat’,… ‘SaveMatFilename’,’C:\results\allpatches.mat’); Creates file allpatches.mat in folder C:\results that contains all the 32 × 32 patches |
raw | Save intensity values into separate text files—one per spectral band | patchit(‘image.jpg’,[15 15],… ‘Stride’,[64 64],’SaveMode’,’raw’,… ‘SaveRawFilename’,’C:\results\rawdata.txt’); Creates a separate text file (one per each spectral band) in folder C:\results. Assuming that ‘image.jpg’ is a multispectral image with eight bands, the following eight text files are created: ‘C:\results\rawdata1.txt’ ‘C:\results\rawdata2.txt’ … ‘C:\results\rawdata8.txt’ corresponding to intensity values for each spectral band. |
Patch Indexing Value | Description | Indexing Example | Patch Values Example |
---|---|---|---|
default | no change | 1 4 7 1 4 7 2 5 8 → 2 5 8 3 6 9 3 6 9 | 124 128 133 124 128 133 143 143 140 → 143 143 140 159 158 151 159 158 151 |
mirror | horizontal flip | 1 4 7 7 4 1 2 5 8 → 8 5 2 3 6 9 9 6 3 | 124 128 133 133 128 124 143 143 140 → 140 143 143 159 158 151 151 158 159 |
flip | vertical flip | 1 4 7 3 6 9 2 5 8 → 2 5 8 3 6 9 1 4 7 | 124 128 133 159 158 151 143 143 140 → 143 143 140 159 158 151 124 128 133 |
swap | x-y exchange | 1 4 7 1 2 3 2 5 8 → 4 5 6 3 6 9 7 8 9 | 124 128 133 124 143 159 143 143 140 → 128 143 158 159 158 151 133 140 151 |
spiralout | inner-to-outer spiral pattern | 1 4 7 7 8 9 2 5 8 → 6 1 2 3 6 9 5 4 3 | 124 128 133 143 158 124 143 143 140 → 140 159 128 159 158 151 151 143 133 |
spiralin | outer-to-inner spiral pattern | 1 4 7 1 2 3 2 5 8 → 8 9 4 3 6 9 7 6 5 | 124 128 133 124 140 159 143 143 140 → 128 151 143 159 158 151 133 158 143 |
PatchIndexing Value | Resulting Patch | PatchIndexing Value | Resulting Patch |
---|---|---|---|
default | flip + swap (rotate 90° clockwise) | ||
mirror | flip + mirror (rotate 180°) | ||
flip | spiralout | ||
swap | spiralin |
Patch Dimensions (W × H) | Patches (N) | Memory (Bytes) | Time (s) | Time (s) | |||||
---|---|---|---|---|---|---|---|---|---|
Images | .Mat | Raw Files | |||||||
Direct | Block | Direct | Block | Direct | Block | ||||
50 × 50 | 100 | 750,000 | 0.18 | 0.1 | 0.3 | 0.0 | 0.1 | 0.3 | 0.5 |
50 × 50 | 200 | 1,500,000 | 0.36 | 0.3 | 0.7 | 0.1 | 0.2 | 0.7 | 1.2 |
50 × 50 | 500 | 3,750,000 | 0.90 | 3.8 | 3.9 | 0.9 | 1.2 | 8.5 | 11.8 |
4 × 4 | 9409 | 462,471,168 | 57.5 | 57.9 | 13.7 | 15.5 | 124.6 | 215.1 | |
1 × 1 | 148,225 | 7,285,555,200 | - | 927.1 | - | 215.6 | - | 2077.4 |
Patch Dimensions (W × H) | Patches (N) | Time (s) | ||
---|---|---|---|---|
Images | .Mat | Raw Files | ||
50 × 50 | 100 | 0.18 | 0.03 | 0.22 |
50 × 50 | 200 | 0.36 | 0.04 | 0.44 |
50 × 50 | 500 | 0.90 | 0.07 | 1.04 |
100 × 100 | 100 | 0.25 | 0.06 | 0.91 |
100 × 100 | 200 | 0.49 | 0.10 | 1.76 |
100 × 100 | 500 | 1.20 | 0.22 | 4.27 |
200 × 200 | 100 | 0.49 | 0.21 | 4.37 |
200 × 200 | 200 | 1.01 | 0.46 | 8.53 |
200 × 200 | 500 | 2.61 | 0.79 | 21.00 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Kesidis, A.L.; Krassanakis, V.; Misthos, L.-M.; Merlemis, N. patchIT: A Multipurpose Patch Creation Tool for Image Processing Applications. Multimodal Technol. Interact. 2022, 6, 111. https://doi.org/10.3390/mti6120111
Kesidis AL, Krassanakis V, Misthos L-M, Merlemis N. patchIT: A Multipurpose Patch Creation Tool for Image Processing Applications. Multimodal Technologies and Interaction. 2022; 6(12):111. https://doi.org/10.3390/mti6120111
Chicago/Turabian StyleKesidis, Anastasios L., Vassilios Krassanakis, Loukas-Moysis Misthos, and Nikolaos Merlemis. 2022. "patchIT: A Multipurpose Patch Creation Tool for Image Processing Applications" Multimodal Technologies and Interaction 6, no. 12: 111. https://doi.org/10.3390/mti6120111
APA StyleKesidis, A. L., Krassanakis, V., Misthos, L. -M., & Merlemis, N. (2022). patchIT: A Multipurpose Patch Creation Tool for Image Processing Applications. Multimodal Technologies and Interaction, 6(12), 111. https://doi.org/10.3390/mti6120111