images-into-array 2.0.7__tar.gz → 3.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Sujit Mandal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,298 @@
1
+ Metadata-Version: 2.4
2
+ Name: images-into-array
3
+ Version: 3.0.1
4
+ Summary: Convert multiple images into NumPy arrays and different color spaces
5
+ Home-page: https://github.com/sujitmandal/images-into-array
6
+ Author: Sujit Mandal
7
+ Author-email: mandals974@gmail.com
8
+ License: MIT
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: numpy
25
+ Requires-Dist: opencv-python
26
+ Requires-Dist: tqdm
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: license
34
+ Dynamic: license-file
35
+ Dynamic: requires-dist
36
+ Dynamic: requires-python
37
+ Dynamic: summary
38
+
39
+ # images-into-array
40
+
41
+ [![Build Status](https://travis-ci.org/sujitmandal/images-into-array.svg?branch=master)](https://travis-ci.org/sujitmandal/images-into-array) [![GitHub license](https://img.shields.io/github/license/sujitmandal/images-into-array)](https://github.com/sujitmandal/images-into-array/blob/master/LICENSE) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/images-into-array) ![PyPI - Wheel](https://img.shields.io/pypi/wheel/images-into-array) ![PyPI](https://img.shields.io/pypi/v/images-into-array) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/images-into-array.svg)](https://anaconda.org/conda-forge/images-into-array) [![Anaconda-Server Badge](https://anaconda.org/conda-forge/images-into-array/badges/version.svg)](https://anaconda.org/conda-forge/images-into-array) [![Anaconda-Server Badge](https://anaconda.org/conda-forge/images-into-array/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge) [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/images-into-array.svg)](https://anaconda.org/conda-forge/images-into-array) [![Conda Recipe](https://img.shields.io/badge/recipe-images--into--array-green.svg)](https://anaconda.org/conda-forge/images-into-array) ![](https://dev.azure.com/conda-forge/feedstock-builds/_apis/build/status/images-into-array-feedstock?branchName=main)
42
+
43
+ [![Downloads](https://pepy.tech/badge/images-into-array)](https://pepy.tech/project/images-into-array)
44
+
45
+ `images-into-array` is a Python package for loading multiple images from
46
+ a directory, resizing them to a common size, optionally converting them
47
+ into different OpenCV color spaces, and returning them as NumPy arrays.
48
+
49
+ The package was originally developed as part of research work on masked
50
+ face detection and employee access control.
51
+
52
+ ## Features
53
+
54
+ - Load multiple images from a directory.
55
+ - Resize images to a specified height and width.
56
+ - Return images as NumPy arrays.
57
+ - Support grayscale and multiple OpenCV color spaces.
58
+ - Preserve the original public function names for backwards
59
+ compatibility.
60
+ - Simple API suitable for computer-vision and machine-learning
61
+ workflows.
62
+
63
+ ## Installation
64
+
65
+ ### PyPI
66
+
67
+ ``` bash
68
+ pip install images-into-array
69
+ ```
70
+
71
+ ### Conda
72
+
73
+ ``` bash
74
+ conda install -c conda-forge images-into-array
75
+ ```
76
+
77
+ [Package Link](https://pypi.org/project/images-into-array/)
78
+
79
+
80
+ [Conda Package Link](https://anaconda.org/conda-forge/images-into-array)
81
+
82
+ [images-into-array-feedstock](https://github.com/conda-forge/images-into-array-feedstock)
83
+
84
+
85
+ ## Usage
86
+
87
+ The image directory and image dimensions should be supplied to the
88
+ functions.
89
+
90
+ ``` python
91
+ from images_into_array import images
92
+
93
+ images_path = "/path/to/images"
94
+ image_height = 32
95
+ image_width = 32
96
+
97
+ image_array = images(images_path, image_height, image_width)
98
+
99
+ print(image_array.shape)
100
+ ```
101
+
102
+ For example, if the directory contains 100 RGB/BGR images and the
103
+ requested size is `32 x 32`, the returned array will normally have a
104
+ shape similar to:
105
+
106
+ ``` text
107
+ (100, 32, 32, 3)
108
+ ```
109
+
110
+ For grayscale images:
111
+
112
+ ``` text
113
+ (100, 32, 32)
114
+ ```
115
+
116
+ > Note: OpenCV reads color images in **BGR** order by default. The
117
+ > package therefore uses OpenCV's BGR-based color conversion operations.
118
+
119
+ ## Supported Functions
120
+
121
+ Function OpenCV conversion Description
122
+ --------------- ------------------- -----------------------------
123
+ `images()` None Load normal color images
124
+ `rgb_gray()` `BGR2GRAY` Convert images to grayscale
125
+ `rgb_lab()` `BGR2Lab` Convert images to Lab
126
+ `rgb_hsv()` `BGR2HSV` Convert images to HSV
127
+ `rgb_ycrcb()` `BGR2YCrCb` Convert images to YCrCb
128
+ `rgb_hls()` `BGR2HLS` Convert images to HLS
129
+ `rgb_luv()` `BGR2Luv` Convert images to Luv
130
+
131
+ The `rgb_*` function names are retained for compatibility with earlier
132
+ versions of the package.
133
+
134
+ ## Examples
135
+
136
+ ### Normal Images
137
+
138
+ ``` python
139
+ from images_into_array import images
140
+
141
+ images_path = "/path/to/images"
142
+ image_height = 32
143
+ image_width = 32
144
+
145
+ data = images(images_path, image_height, image_width)
146
+ ```
147
+
148
+ ### Grayscale
149
+
150
+ ``` python
151
+ from images_into_array import rgb_gray
152
+
153
+ data = rgb_gray(images_path, image_height, image_width)
154
+ ```
155
+
156
+ ### Lab
157
+
158
+ ``` python
159
+ from images_into_array import rgb_lab
160
+
161
+ data = rgb_lab(images_path, image_height, image_width)
162
+ ```
163
+
164
+ ### HSV
165
+
166
+ ``` python
167
+ from images_into_array import rgb_hsv
168
+
169
+ data = rgb_hsv(images_path, image_height, image_width)
170
+ ```
171
+
172
+ ### YCrCb
173
+
174
+ ``` python
175
+ from images_into_array import rgb_ycrcb
176
+
177
+ data = rgb_ycrcb(images_path, image_height, image_width)
178
+ ```
179
+
180
+ ### HLS
181
+
182
+ ``` python
183
+ from images_into_array import rgb_hls
184
+
185
+ data = rgb_hls(images_path, image_height, image_width)
186
+ ```
187
+
188
+ ### Luv
189
+
190
+ ``` python
191
+ from images_into_array import rgb_luv
192
+
193
+ data = rgb_luv(images_path, image_height, image_width)
194
+ ```
195
+
196
+ ## Requirements
197
+
198
+ The package uses:
199
+
200
+ - Python
201
+ - NumPy
202
+ - OpenCV
203
+ - tqdm
204
+
205
+ Install the main dependencies with:
206
+
207
+ ``` bash
208
+ pip install numpy opencv-python tqdm
209
+ ```
210
+
211
+ The package does **not** require the third-party `shuffle` package.
212
+ Python provides `random.shuffle` as part of the standard library.
213
+
214
+ ## Important Notes
215
+
216
+ ### Image dimensions
217
+
218
+ OpenCV's `cv2.resize()` expects the size in:
219
+
220
+ ``` python
221
+ (width, height)
222
+ ```
223
+
224
+ Therefore, even though the API accepts:
225
+
226
+ ``` python
227
+ image_height
228
+ image_width
229
+ ```
230
+
231
+ the resize operation should use:
232
+
233
+ ``` python
234
+ cv2.resize(image, (image_width, image_height))
235
+ ```
236
+
237
+ ### Invalid or unreadable images
238
+
239
+ If an image cannot be read by OpenCV, `cv2.imread()` may return `None`.
240
+ Production code should handle such files rather than attempting to
241
+ resize them.
242
+
243
+ ### Reproducibility
244
+
245
+ If the image order is shuffled for machine-learning experiments,
246
+ consider using a fixed random seed when reproducible experiments are
247
+ required.
248
+
249
+ ## Research
250
+
251
+ This package was developed in connection with research on masked face
252
+ detection and selected employee access to workplaces.
253
+
254
+ ### Published Research
255
+
256
+ **Mandal, S., Saha, M. & Chatterji, B.N.**\
257
+ *Masked Face Detection and Selected Employee Access to Workplaces: A
258
+ Step Towards Coronavirus Prevention.*
259
+
260
+ Journal of The Institution of Engineers (India): Series B, **104**,
261
+ 1353--1368 (2023).
262
+
263
+ DOI: https://doi.org/10.1007/s40031-023-00945-5
264
+
265
+ The research presents a CCTV-based approach for detecting masked faces
266
+ and identifying selected employees, using a two-tier convolutional
267
+ neural network.
268
+
269
+ ## Source Code
270
+
271
+ GitHub repository:
272
+
273
+ https://github.com/sujitmandal/images-into-array
274
+
275
+ PyPI:
276
+
277
+ https://pypi.org/project/images-into-array/
278
+
279
+ ## License
280
+
281
+ This project is licensed under the MIT License.
282
+
283
+ See the `LICENSE` file for details.
284
+
285
+ ## Author
286
+
287
+ **Sujit Mandal**
288
+
289
+ GitHub: https://github.com/sujitmandal
290
+
291
+ ## Citation
292
+
293
+ If you use this package or the associated research in academic work,
294
+ please cite the published paper:
295
+
296
+ ``` text
297
+ Mandal, S., Saha, M. & Chatterji, B.N. Masked Face Detection and Selected Employee Access to Workplaces: A Step Towards Coronavirus Prevention. Journal of The Institution of Engineers (India): Series B 104, 1353–1368 (2023). https://doi.org/10.1007/s40031-023-00945-5
298
+ ```
@@ -0,0 +1,260 @@
1
+ # images-into-array
2
+
3
+ [![Build Status](https://travis-ci.org/sujitmandal/images-into-array.svg?branch=master)](https://travis-ci.org/sujitmandal/images-into-array) [![GitHub license](https://img.shields.io/github/license/sujitmandal/images-into-array)](https://github.com/sujitmandal/images-into-array/blob/master/LICENSE) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/images-into-array) ![PyPI - Wheel](https://img.shields.io/pypi/wheel/images-into-array) ![PyPI](https://img.shields.io/pypi/v/images-into-array) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/images-into-array.svg)](https://anaconda.org/conda-forge/images-into-array) [![Anaconda-Server Badge](https://anaconda.org/conda-forge/images-into-array/badges/version.svg)](https://anaconda.org/conda-forge/images-into-array) [![Anaconda-Server Badge](https://anaconda.org/conda-forge/images-into-array/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge) [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/images-into-array.svg)](https://anaconda.org/conda-forge/images-into-array) [![Conda Recipe](https://img.shields.io/badge/recipe-images--into--array-green.svg)](https://anaconda.org/conda-forge/images-into-array) ![](https://dev.azure.com/conda-forge/feedstock-builds/_apis/build/status/images-into-array-feedstock?branchName=main)
4
+
5
+ [![Downloads](https://pepy.tech/badge/images-into-array)](https://pepy.tech/project/images-into-array)
6
+
7
+ `images-into-array` is a Python package for loading multiple images from
8
+ a directory, resizing them to a common size, optionally converting them
9
+ into different OpenCV color spaces, and returning them as NumPy arrays.
10
+
11
+ The package was originally developed as part of research work on masked
12
+ face detection and employee access control.
13
+
14
+ ## Features
15
+
16
+ - Load multiple images from a directory.
17
+ - Resize images to a specified height and width.
18
+ - Return images as NumPy arrays.
19
+ - Support grayscale and multiple OpenCV color spaces.
20
+ - Preserve the original public function names for backwards
21
+ compatibility.
22
+ - Simple API suitable for computer-vision and machine-learning
23
+ workflows.
24
+
25
+ ## Installation
26
+
27
+ ### PyPI
28
+
29
+ ``` bash
30
+ pip install images-into-array
31
+ ```
32
+
33
+ ### Conda
34
+
35
+ ``` bash
36
+ conda install -c conda-forge images-into-array
37
+ ```
38
+
39
+ [Package Link](https://pypi.org/project/images-into-array/)
40
+
41
+
42
+ [Conda Package Link](https://anaconda.org/conda-forge/images-into-array)
43
+
44
+ [images-into-array-feedstock](https://github.com/conda-forge/images-into-array-feedstock)
45
+
46
+
47
+ ## Usage
48
+
49
+ The image directory and image dimensions should be supplied to the
50
+ functions.
51
+
52
+ ``` python
53
+ from images_into_array import images
54
+
55
+ images_path = "/path/to/images"
56
+ image_height = 32
57
+ image_width = 32
58
+
59
+ image_array = images(images_path, image_height, image_width)
60
+
61
+ print(image_array.shape)
62
+ ```
63
+
64
+ For example, if the directory contains 100 RGB/BGR images and the
65
+ requested size is `32 x 32`, the returned array will normally have a
66
+ shape similar to:
67
+
68
+ ``` text
69
+ (100, 32, 32, 3)
70
+ ```
71
+
72
+ For grayscale images:
73
+
74
+ ``` text
75
+ (100, 32, 32)
76
+ ```
77
+
78
+ > Note: OpenCV reads color images in **BGR** order by default. The
79
+ > package therefore uses OpenCV's BGR-based color conversion operations.
80
+
81
+ ## Supported Functions
82
+
83
+ Function OpenCV conversion Description
84
+ --------------- ------------------- -----------------------------
85
+ `images()` None Load normal color images
86
+ `rgb_gray()` `BGR2GRAY` Convert images to grayscale
87
+ `rgb_lab()` `BGR2Lab` Convert images to Lab
88
+ `rgb_hsv()` `BGR2HSV` Convert images to HSV
89
+ `rgb_ycrcb()` `BGR2YCrCb` Convert images to YCrCb
90
+ `rgb_hls()` `BGR2HLS` Convert images to HLS
91
+ `rgb_luv()` `BGR2Luv` Convert images to Luv
92
+
93
+ The `rgb_*` function names are retained for compatibility with earlier
94
+ versions of the package.
95
+
96
+ ## Examples
97
+
98
+ ### Normal Images
99
+
100
+ ``` python
101
+ from images_into_array import images
102
+
103
+ images_path = "/path/to/images"
104
+ image_height = 32
105
+ image_width = 32
106
+
107
+ data = images(images_path, image_height, image_width)
108
+ ```
109
+
110
+ ### Grayscale
111
+
112
+ ``` python
113
+ from images_into_array import rgb_gray
114
+
115
+ data = rgb_gray(images_path, image_height, image_width)
116
+ ```
117
+
118
+ ### Lab
119
+
120
+ ``` python
121
+ from images_into_array import rgb_lab
122
+
123
+ data = rgb_lab(images_path, image_height, image_width)
124
+ ```
125
+
126
+ ### HSV
127
+
128
+ ``` python
129
+ from images_into_array import rgb_hsv
130
+
131
+ data = rgb_hsv(images_path, image_height, image_width)
132
+ ```
133
+
134
+ ### YCrCb
135
+
136
+ ``` python
137
+ from images_into_array import rgb_ycrcb
138
+
139
+ data = rgb_ycrcb(images_path, image_height, image_width)
140
+ ```
141
+
142
+ ### HLS
143
+
144
+ ``` python
145
+ from images_into_array import rgb_hls
146
+
147
+ data = rgb_hls(images_path, image_height, image_width)
148
+ ```
149
+
150
+ ### Luv
151
+
152
+ ``` python
153
+ from images_into_array import rgb_luv
154
+
155
+ data = rgb_luv(images_path, image_height, image_width)
156
+ ```
157
+
158
+ ## Requirements
159
+
160
+ The package uses:
161
+
162
+ - Python
163
+ - NumPy
164
+ - OpenCV
165
+ - tqdm
166
+
167
+ Install the main dependencies with:
168
+
169
+ ``` bash
170
+ pip install numpy opencv-python tqdm
171
+ ```
172
+
173
+ The package does **not** require the third-party `shuffle` package.
174
+ Python provides `random.shuffle` as part of the standard library.
175
+
176
+ ## Important Notes
177
+
178
+ ### Image dimensions
179
+
180
+ OpenCV's `cv2.resize()` expects the size in:
181
+
182
+ ``` python
183
+ (width, height)
184
+ ```
185
+
186
+ Therefore, even though the API accepts:
187
+
188
+ ``` python
189
+ image_height
190
+ image_width
191
+ ```
192
+
193
+ the resize operation should use:
194
+
195
+ ``` python
196
+ cv2.resize(image, (image_width, image_height))
197
+ ```
198
+
199
+ ### Invalid or unreadable images
200
+
201
+ If an image cannot be read by OpenCV, `cv2.imread()` may return `None`.
202
+ Production code should handle such files rather than attempting to
203
+ resize them.
204
+
205
+ ### Reproducibility
206
+
207
+ If the image order is shuffled for machine-learning experiments,
208
+ consider using a fixed random seed when reproducible experiments are
209
+ required.
210
+
211
+ ## Research
212
+
213
+ This package was developed in connection with research on masked face
214
+ detection and selected employee access to workplaces.
215
+
216
+ ### Published Research
217
+
218
+ **Mandal, S., Saha, M. & Chatterji, B.N.**\
219
+ *Masked Face Detection and Selected Employee Access to Workplaces: A
220
+ Step Towards Coronavirus Prevention.*
221
+
222
+ Journal of The Institution of Engineers (India): Series B, **104**,
223
+ 1353--1368 (2023).
224
+
225
+ DOI: https://doi.org/10.1007/s40031-023-00945-5
226
+
227
+ The research presents a CCTV-based approach for detecting masked faces
228
+ and identifying selected employees, using a two-tier convolutional
229
+ neural network.
230
+
231
+ ## Source Code
232
+
233
+ GitHub repository:
234
+
235
+ https://github.com/sujitmandal/images-into-array
236
+
237
+ PyPI:
238
+
239
+ https://pypi.org/project/images-into-array/
240
+
241
+ ## License
242
+
243
+ This project is licensed under the MIT License.
244
+
245
+ See the `LICENSE` file for details.
246
+
247
+ ## Author
248
+
249
+ **Sujit Mandal**
250
+
251
+ GitHub: https://github.com/sujitmandal
252
+
253
+ ## Citation
254
+
255
+ If you use this package or the associated research in academic work,
256
+ please cite the published paper:
257
+
258
+ ``` text
259
+ Mandal, S., Saha, M. & Chatterji, B.N. Masked Face Detection and Selected Employee Access to Workplaces: A Step Towards Coronavirus Prevention. Journal of The Institution of Engineers (India): Series B 104, 1353–1368 (2023). https://doi.org/10.1007/s40031-023-00945-5
260
+ ```