VrOne/Python Programming

ON-LINE REFERENCE DOCUMENTATION

CARDINAL SYSTEMS, LLC

386-439-2525    

www.cardinalsystems.net   
 

 

PyVrImgMgr Class Reference

VrOne/Python image management routines. More...

Members


Detailed Description

Allows management of images in VrOne. Images can be opened and closed. Information about currently open images can be queried. Settings for images can be changed, such as brightness, color maps, and location. Provides methods for converting between ground and image coordinates and for reading image data.


Member Function Documentation

Open (FileName, MakePyra, ReadWorld)

Allocates an image object and opens an image.

FileName

Image file name.

MakePyra

Make image pyramids? 0=No 1=Yes(default)

ReadWorld

Read world file? 0=No 1=Yes(default)

returns

(ret)

 

ret

Image sequence number (0-MaxImgs-1) -1 Could not open file.

IsOpen (FileName)

Checks to see if an image is open

FileName

Image name to check.

returns

(ret)

 

ret

0=Image not open,1=Image is open

CloseByIdx (ImgNum)

Closes an image using index number.

ImgNum

Image to close.

CloseByName (FileName)

Closes an image using image name.

FileName

File name that was used to open the image.

CloseAll ()

Closes all open images

GetIndexColorMap (ImgNum)

Get index color map for a simgle image This is the internal colormap for index based images.

ImgNum

Image index number.

returns

(ret)

 

ret

List of 255 RGB color values

GetColor (ImgNum, Idx)

Gets RGB color for a single index value.

ImgNum

Image index number.

Idx

Color index (0-255)

returns

(Red, Green, Blue)

 

Red

0-255

 

Green

0-255

 

Blue

0-255

IsIndexed (ImgNum)

Is image index color based.

ImgNum

Image index number to check

GetImgCount ()

Returns the number of images currently open.

returns

(ret)

 

ret

Number of images currently open

GetImgDepth (ImgNum)

Returns the image bit depth for the image specified.

ImgNum

Image index number. if the image number is out of range, 0 is returned.

returns

(ret)

 

ret

Image bit depth (8, 16, 24)

GetImgSizeInt (ImgNum, PixIncr=1)

Returns the image width and height for the image specified.

ImgNum

Image index number.

PixIncr

Pixel increment to retrieve size for. 1,2,4,8,16,32,64

returns

(ret, Width, Height)

 

ret

0 = OK -1 = Image index number out of range

 

Width

Image width.

 

Height

Image height

GetImgSizeFloat (ImgNum, PixIncr=1)

Returns the image width and height for the image specified.

ImgNum

Image index number.

PixIncr

Pixel increment to retrieve size for. 1,2,4,8,16,32,64

returns

(ret, Width, Height)

 

ret

0 = OK -1 = Image index number out of range

 

Width

 

 

Height

 

Clamp (ImgNum, PixIncr, StartX, StartY, Wdt, Hgt)

Clamp values to image size at a give pixel increment

ImgNum

Image index number.

PixIncr

Pixel increment 1,2,4,8,16,32,64

StartX

Start X of window to clamp

StartY

Start Y of window to clamp

Wdt

Width of window to clamp

Hgt

Height of window to clamp

returns

(ret, StartX, StartY, Wdt, Hgt)

 

ret

0=Invalid image index number, 1=Clamped

 

StartX

New start X

 

StartY

New start Y

 

Wdt

New Width of window

 

Hgt

New Height of window

GetImgPixelSize (ImgNum)

Returns the image pixel size

ImgNum

Image index number.

returns

(ret)

 

ret

Return pixel size. (ground)

GetImgFileName (ImgNum)

Returns the image filename of the image specified.

ImgNum

Image index number.

returns

(ret, FileName)

 

ret

0 = OK -1 = Image index number out of range.

 

FileName

Image file name.

GetImgNum (FileName)

Returns image index number based on file name

FileName

Image file name.

returns

(ret, ImgNum)

 

ret

0 = OK -1 = Filename not found.

 

ImgNum

Return image index number

GetImgOffset (ImgNum)

Returns the current image offset (if Origin has been changed)

ImgNum

Image index number. If the image number is out of range, 0.0, 0.0 is returned.

returns

(OfsX, OfsY)

 

OfsX

Offset X (ground)

 

OfsY

Offset Y (ground)

GroundToImage (ImgNum, gx, gy)

Converts ground coordinate to image coordinate.

ImgNum

Image index number.

gx

Input ground coordinate X

gy

Input ground coordinate Y

returns

(ix, iy)

 

ix

Output image coordinate X

 

iy

Output image coordinate Y

ImageToGround (ImgNum, ix, iy)

Converts ground coordinate to image coordinate.

ImgNum

Image index number.

ix

Input image coordinate X

iy

Input image coordinate Y

returns

(gx, gy)

 

gx

Output ground coordinate X

 

gy

Output ground coordinate Y

GetImgCorner (ImgNum, Corner)

ImgNum

Image index number.

Corner

Corner to get: 1 - Lower left. 2 - Lower right. 3 - Upper right. 4 - Upper left.

returns

(ret, x, y)

 

x

Corner X

 

y

Corner Y

GetImgCenter (ImgNum, x, y)

Returns the image center coordinate in ground units.

ImgNum

Image index number

returns

(ret, x, y)

 

ret

0 = OK -1 = Image index number out of range.

 

x

Corner X

 

y

Corner Y

GetImgWin (ImgNum, StartX, StartY, SizeX, SizeY, PixIncr)

Reads a window of image data based on window parameters sent.

ImgNum

Image index number.

StartX

Start pixel column.

StartY

Start pixel row.

SizeX

Number of columns to read.

SizeY

Number or rows to read.

PixIncr

Pixel increment used for downsampling (2=read every other pixel)

returns

(ret, ImageMemory)

 

ret

0 = O -1 = Image index number out of range

 

ImageMemory

List of pixel rows and values. List is in [rows][cols] format. Each item in rows is 1 or 3 item list of pixel values.

SetWorld (ImgNum, ScaleX, ScaleY, RotX, RotY, UpLeftX, UpLeftY, WriteFile)

Sets the world file transformation parameters and optionally writes the file.

ImgNum

Image index number.

ScaleX

X direction pixel size (ground)

ScaleY

Y direction pixel size (ground, sign will be reversed, send as positive)

RotX

X rotation

RotY

Y rotation

UpLeftX

Upper left coordinate (ground)

UpLeftY

Upper left coordinate (ground)

WriteFile

0=Don't write file, 1=Write file

returns

(ret)

 

ret

0 = OK -1 = Image index number out of range

GetWorld (ImgNum)

Get the current world file transformation parameters.

ImgNum

Image index number.

returns

(ret, ScaleX, ScaleY, RotX, RotY, UpLeftX, UpLeftY)

 

ret

0 = OK -1 = ImgNum invalid

 

ScaleX

X direction pixel size (ground)

 

ScaleY

Y direction pixel size (ground)

 

RotX

X rotation

 

RotY

Y rotation

 

UpLeftX

Upper left coordinate (ground)

 

UpLeftY

Upper left coordinate (ground)

GetRotation (ImgNum)

Get the current world file rotation

ImgNum

Image index number.

returns

(ret)

 

ret

World file rotation

ShiftWorld (ImgNum, ShiftX, ShiftY, WriteFile)

Shifts the world file transformation parameters and optionally writes file.

ImgNum

Image index number.

ShiftX

X direction shift value (ground)

ShiftY

Y direction shift value (ground)

WriteFile

0=Don't write file, 1=Write file

returns

(ret)

 

ret

0 = OK -1 = Image index number out of range

GetBrightContrast (ImgNum)

Gets current brightness and contrast of image

ImgNum

Image index number to get

returns

(ret, Bright, Contrast)

 

ret

0 = OK -1 = Image index number out of range

 

Bright

Brightness index 0-100 (50=None)

 

Contrast

Contrast index 0-100 (50=None)

SetBrightContrast (ImgNum, Bright, Contrast)

Sets current brightness and contrast of image

Bright

Brightness index 0-100 (50=None, -1=No Change)

Contrast

Contrast index 0-100 (50=None, -1=No Change)

ImgNum

Image index number to adjust (-1=All=default)

returns

(ret)

 

ret

0 = OK -1 = Image index number out of range

AddColorMap (ImgNum, ColorMap, Type)

Set color map to be applied whenever pixels are read from the image.

ImgNum

Image index number this applies to or -1 for all images

ColorMap

3x256 list of values for colormap

Type

Color map type. User defined value. Should start at 1000 or greater to avoid conflict with Vr types. for each type added, there can only be one colormap. If a colormap with the same type already exists, it will be replaced.

RemoveColorMap (ImgNum, Type)

Add color map to be applied whenever pixels are read from the image.

ImgNum

Image index number this applies to or -1 for all images

Type

Color map type.

SetColorMap (ImgNum, ColorMap)

Set default color map to be applied whenever pixels are read from the image.

ImgNum

Image index number this applies to or -1 for all images

ColorMap