File: save_image.docstring

package info (click to toggle)
mrcal 2.5-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 8,444 kB
  • sloc: python: 40,601; ansic: 15,576; cpp: 1,754; perl: 303; makefile: 158; sh: 98; lisp: 84
file content (39 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Save a numpy array to an image on disk

SYNOPSIS

    print(image.shape)
    ---> (768, 1024, 3)

    print(image.dtype)
    ---> dtype('uint8')

    mrcal.save_image("result.png", image)

    # wrote BGR color image to disk

This is a completely uninteresting image-saving routine. It's like any other
image-saving routine out there; use any that you like. This exists because cv2
is very slow.

This wraps the mrcal_image_TYPE_save() functions. At this time I support only
these 3 data formats:

- bpp = 8,  channels = 1: 8-bit grayscale data
- bpp = 16, channels = 1: 16-bit grayscale data
- bpp = 24, channels = 3: BGR color data

ARGUMENTS

- filename: the image on disk to save to

- array: numpy array containing the input data. Must have shape (height,width)
  for grayscale data or (height,width,3) for color data. Each row must be stored
  densely, but a non-dense stride is supported when moving from column to
  column. The dtype must be either np.uint8 or np.uint16.

RETURNED VALUE

None on success. Exception thrown on error