images-into-array 2.0.7__tar.gz → 3.0.0__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,290 @@
1
+ Metadata-Version: 2.4
2
+ Name: images-into-array
3
+ Version: 3.0.0
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
+ ## Usage
78
+
79
+ The image directory and image dimensions should be supplied to the
80
+ functions.
81
+
82
+ ``` python
83
+ from images_into_array import images
84
+
85
+ images_path = "/path/to/images"
86
+ image_height = 32
87
+ image_width = 32
88
+
89
+ image_array = images(images_path, image_height, image_width)
90
+
91
+ print(image_array.shape)
92
+ ```
93
+
94
+ For example, if the directory contains 100 RGB/BGR images and the
95
+ requested size is `32 x 32`, the returned array will normally have a
96
+ shape similar to:
97
+
98
+ ``` text
99
+ (100, 32, 32, 3)
100
+ ```
101
+
102
+ For grayscale images:
103
+
104
+ ``` text
105
+ (100, 32, 32)
106
+ ```
107
+
108
+ > Note: OpenCV reads color images in **BGR** order by default. The
109
+ > package therefore uses OpenCV's BGR-based color conversion operations.
110
+
111
+ ## Supported Functions
112
+
113
+ Function OpenCV conversion Description
114
+ --------------- ------------------- -----------------------------
115
+ `images()` None Load normal color images
116
+ `rgb_gray()` `BGR2GRAY` Convert images to grayscale
117
+ `rgb_lab()` `BGR2Lab` Convert images to Lab
118
+ `rgb_hsv()` `BGR2HSV` Convert images to HSV
119
+ `rgb_ycrcb()` `BGR2YCrCb` Convert images to YCrCb
120
+ `rgb_hls()` `BGR2HLS` Convert images to HLS
121
+ `rgb_luv()` `BGR2Luv` Convert images to Luv
122
+
123
+ The `rgb_*` function names are retained for compatibility with earlier
124
+ versions of the package.
125
+
126
+ ## Examples
127
+
128
+ ### Normal Images
129
+
130
+ ``` python
131
+ from images_into_array import images
132
+
133
+ images_path = "/path/to/images"
134
+ image_height = 32
135
+ image_width = 32
136
+
137
+ data = images(images_path, image_height, image_width)
138
+ ```
139
+
140
+ ### Grayscale
141
+
142
+ ``` python
143
+ from images_into_array import rgb_gray
144
+
145
+ data = rgb_gray(images_path, image_height, image_width)
146
+ ```
147
+
148
+ ### Lab
149
+
150
+ ``` python
151
+ from images_into_array import rgb_lab
152
+
153
+ data = rgb_lab(images_path, image_height, image_width)
154
+ ```
155
+
156
+ ### HSV
157
+
158
+ ``` python
159
+ from images_into_array import rgb_hsv
160
+
161
+ data = rgb_hsv(images_path, image_height, image_width)
162
+ ```
163
+
164
+ ### YCrCb
165
+
166
+ ``` python
167
+ from images_into_array import rgb_ycrcb
168
+
169
+ data = rgb_ycrcb(images_path, image_height, image_width)
170
+ ```
171
+
172
+ ### HLS
173
+
174
+ ``` python
175
+ from images_into_array import rgb_hls
176
+
177
+ data = rgb_hls(images_path, image_height, image_width)
178
+ ```
179
+
180
+ ### Luv
181
+
182
+ ``` python
183
+ from images_into_array import rgb_luv
184
+
185
+ data = rgb_luv(images_path, image_height, image_width)
186
+ ```
187
+
188
+ ## Requirements
189
+
190
+ The package uses:
191
+
192
+ - Python
193
+ - NumPy
194
+ - OpenCV
195
+ - tqdm
196
+
197
+ Install the main dependencies with:
198
+
199
+ ``` bash
200
+ pip install numpy opencv-python tqdm
201
+ ```
202
+
203
+ The package does **not** require the third-party `shuffle` package.
204
+ Python provides `random.shuffle` as part of the standard library.
205
+
206
+ ## Important Notes
207
+
208
+ ### Image dimensions
209
+
210
+ OpenCV's `cv2.resize()` expects the size in:
211
+
212
+ ``` python
213
+ (width, height)
214
+ ```
215
+
216
+ Therefore, even though the API accepts:
217
+
218
+ ``` python
219
+ image_height
220
+ image_width
221
+ ```
222
+
223
+ the resize operation should use:
224
+
225
+ ``` python
226
+ cv2.resize(image, (image_width, image_height))
227
+ ```
228
+
229
+ ### Invalid or unreadable images
230
+
231
+ If an image cannot be read by OpenCV, `cv2.imread()` may return `None`.
232
+ Production code should handle such files rather than attempting to
233
+ resize them.
234
+
235
+ ### Reproducibility
236
+
237
+ If the image order is shuffled for machine-learning experiments,
238
+ consider using a fixed random seed when reproducible experiments are
239
+ required.
240
+
241
+ ## Research
242
+
243
+ This package was developed in connection with research on masked face
244
+ detection and selected employee access to workplaces.
245
+
246
+ ### Published Research
247
+
248
+ **Mandal, S., Saha, M. & Chatterji, B.N.**\
249
+ *Masked Face Detection and Selected Employee Access to Workplaces: A
250
+ Step Towards Coronavirus Prevention.*
251
+
252
+ Journal of The Institution of Engineers (India): Series B, **104**,
253
+ 1353--1368 (2023).
254
+
255
+ DOI: https://doi.org/10.1007/s40031-023-00945-5
256
+
257
+ The research presents a CCTV-based approach for detecting masked faces
258
+ and identifying selected employees, using a two-tier convolutional
259
+ neural network.
260
+
261
+ ## Source Code
262
+
263
+ GitHub repository:
264
+
265
+ https://github.com/sujitmandal/images-into-array
266
+
267
+ PyPI:
268
+
269
+ https://pypi.org/project/images-into-array/
270
+
271
+ ## License
272
+
273
+ This project is licensed under the MIT License.
274
+
275
+ See the `LICENSE` file for details.
276
+
277
+ ## Author
278
+
279
+ **Sujit Mandal**
280
+
281
+ GitHub: https://github.com/sujitmandal
282
+
283
+ ## Citation
284
+
285
+ If you use this package or the associated research in academic work,
286
+ please cite the published paper:
287
+
288
+ ``` text
289
+ 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
290
+ ```
@@ -0,0 +1,252 @@
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
+ ## Usage
40
+
41
+ The image directory and image dimensions should be supplied to the
42
+ functions.
43
+
44
+ ``` python
45
+ from images_into_array import images
46
+
47
+ images_path = "/path/to/images"
48
+ image_height = 32
49
+ image_width = 32
50
+
51
+ image_array = images(images_path, image_height, image_width)
52
+
53
+ print(image_array.shape)
54
+ ```
55
+
56
+ For example, if the directory contains 100 RGB/BGR images and the
57
+ requested size is `32 x 32`, the returned array will normally have a
58
+ shape similar to:
59
+
60
+ ``` text
61
+ (100, 32, 32, 3)
62
+ ```
63
+
64
+ For grayscale images:
65
+
66
+ ``` text
67
+ (100, 32, 32)
68
+ ```
69
+
70
+ > Note: OpenCV reads color images in **BGR** order by default. The
71
+ > package therefore uses OpenCV's BGR-based color conversion operations.
72
+
73
+ ## Supported Functions
74
+
75
+ Function OpenCV conversion Description
76
+ --------------- ------------------- -----------------------------
77
+ `images()` None Load normal color images
78
+ `rgb_gray()` `BGR2GRAY` Convert images to grayscale
79
+ `rgb_lab()` `BGR2Lab` Convert images to Lab
80
+ `rgb_hsv()` `BGR2HSV` Convert images to HSV
81
+ `rgb_ycrcb()` `BGR2YCrCb` Convert images to YCrCb
82
+ `rgb_hls()` `BGR2HLS` Convert images to HLS
83
+ `rgb_luv()` `BGR2Luv` Convert images to Luv
84
+
85
+ The `rgb_*` function names are retained for compatibility with earlier
86
+ versions of the package.
87
+
88
+ ## Examples
89
+
90
+ ### Normal Images
91
+
92
+ ``` python
93
+ from images_into_array import images
94
+
95
+ images_path = "/path/to/images"
96
+ image_height = 32
97
+ image_width = 32
98
+
99
+ data = images(images_path, image_height, image_width)
100
+ ```
101
+
102
+ ### Grayscale
103
+
104
+ ``` python
105
+ from images_into_array import rgb_gray
106
+
107
+ data = rgb_gray(images_path, image_height, image_width)
108
+ ```
109
+
110
+ ### Lab
111
+
112
+ ``` python
113
+ from images_into_array import rgb_lab
114
+
115
+ data = rgb_lab(images_path, image_height, image_width)
116
+ ```
117
+
118
+ ### HSV
119
+
120
+ ``` python
121
+ from images_into_array import rgb_hsv
122
+
123
+ data = rgb_hsv(images_path, image_height, image_width)
124
+ ```
125
+
126
+ ### YCrCb
127
+
128
+ ``` python
129
+ from images_into_array import rgb_ycrcb
130
+
131
+ data = rgb_ycrcb(images_path, image_height, image_width)
132
+ ```
133
+
134
+ ### HLS
135
+
136
+ ``` python
137
+ from images_into_array import rgb_hls
138
+
139
+ data = rgb_hls(images_path, image_height, image_width)
140
+ ```
141
+
142
+ ### Luv
143
+
144
+ ``` python
145
+ from images_into_array import rgb_luv
146
+
147
+ data = rgb_luv(images_path, image_height, image_width)
148
+ ```
149
+
150
+ ## Requirements
151
+
152
+ The package uses:
153
+
154
+ - Python
155
+ - NumPy
156
+ - OpenCV
157
+ - tqdm
158
+
159
+ Install the main dependencies with:
160
+
161
+ ``` bash
162
+ pip install numpy opencv-python tqdm
163
+ ```
164
+
165
+ The package does **not** require the third-party `shuffle` package.
166
+ Python provides `random.shuffle` as part of the standard library.
167
+
168
+ ## Important Notes
169
+
170
+ ### Image dimensions
171
+
172
+ OpenCV's `cv2.resize()` expects the size in:
173
+
174
+ ``` python
175
+ (width, height)
176
+ ```
177
+
178
+ Therefore, even though the API accepts:
179
+
180
+ ``` python
181
+ image_height
182
+ image_width
183
+ ```
184
+
185
+ the resize operation should use:
186
+
187
+ ``` python
188
+ cv2.resize(image, (image_width, image_height))
189
+ ```
190
+
191
+ ### Invalid or unreadable images
192
+
193
+ If an image cannot be read by OpenCV, `cv2.imread()` may return `None`.
194
+ Production code should handle such files rather than attempting to
195
+ resize them.
196
+
197
+ ### Reproducibility
198
+
199
+ If the image order is shuffled for machine-learning experiments,
200
+ consider using a fixed random seed when reproducible experiments are
201
+ required.
202
+
203
+ ## Research
204
+
205
+ This package was developed in connection with research on masked face
206
+ detection and selected employee access to workplaces.
207
+
208
+ ### Published Research
209
+
210
+ **Mandal, S., Saha, M. & Chatterji, B.N.**\
211
+ *Masked Face Detection and Selected Employee Access to Workplaces: A
212
+ Step Towards Coronavirus Prevention.*
213
+
214
+ Journal of The Institution of Engineers (India): Series B, **104**,
215
+ 1353--1368 (2023).
216
+
217
+ DOI: https://doi.org/10.1007/s40031-023-00945-5
218
+
219
+ The research presents a CCTV-based approach for detecting masked faces
220
+ and identifying selected employees, using a two-tier convolutional
221
+ neural network.
222
+
223
+ ## Source Code
224
+
225
+ GitHub repository:
226
+
227
+ https://github.com/sujitmandal/images-into-array
228
+
229
+ PyPI:
230
+
231
+ https://pypi.org/project/images-into-array/
232
+
233
+ ## License
234
+
235
+ This project is licensed under the MIT License.
236
+
237
+ See the `LICENSE` file for details.
238
+
239
+ ## Author
240
+
241
+ **Sujit Mandal**
242
+
243
+ GitHub: https://github.com/sujitmandal
244
+
245
+ ## Citation
246
+
247
+ If you use this package or the associated research in academic work,
248
+ please cite the published paper:
249
+
250
+ ``` text
251
+ 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
252
+ ```