vx.Vx image container

Constructor

class vx.Vx(image-reference) Image class containing image and meta data

Parameter: image-reference : one of file-name, vx.Vx class, array, PIL-Image.

Contains an image with two or three dimensions (and optionally multiple channels) in an numpy.array with additional metadata.

class vx.Vx() Create a null Vx structure

class vx.Vx('data-type',bbx-tupple,num-channels) Create an image with zero pixel values

Returns: Initialized vx.Vx structure

Attributes and underlying data

Vx.i
The image np.array
Vx.h
The metadata
Vx.c
The number of channels in each pixel

Functions

Vx.setim(<numpy.array> ).
Set the image to the numpy.array
Vx.embedim(<border list tuple>).
Embed image numpy.array with border of zero's
Vx.write(filename)
Write image and metadata to a file

Examples

1. Vx construction from image file


from v4 import vx
from v4 import vd
from numpy import np

sb = vx.Vx("isbird.vx")
print (sb) 
vd.dispvx (sb)

VisionX V4: Vx
    Image Size: (120, 150, 3)
    Pixel Type: uint8
    Number of channels: 3

2. Vx construction with pixel values set to zero


print('2D single channel')
vim = vx.Vx('uint8',(0,5,0,2))
print (vim)
print (vim.i)


2D single channel
VisionX V4: Vx
    Image Size: (2, 5)
    Pixel Type: uint8
    Number of channels: 1

[[0 0 0 0 0]
 [0 0 0 0 0]]


print('3D multichannel')
vim = vx.Vx('float32',(2,4,3),5)
print (vim)
print (vim.i)


3D multichannel
VisionX V4: Vx
    Image Size: (3, 4, 2, 5)
    Pixel Type: float32
    Number of channels: 5

[[[[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]

  [[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]

  [[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]

  [[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]]


 [[[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]

  [[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]

  [[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]

  [[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]]


 [[[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]

  [[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]

  [[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]

  [[0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0.]]]]