2D simple VisionX V4 functions


Vfnewim, Vfembed, Vfread, Vfwrite

int Vfnewim(&i, type, bbx, chan);
float bbx[4];
int type, chan;

int Vfembed(&i, &j ,x1,x2,y1,y2);
float x1,x2,y1,y2;

int Vfread(&i, fname);
char *fname;

int Vfwrite(&i, fname);
char *fname;

Image data in VisionX is managed by a set of programming tools that record image array accessing information in a single structure (VisXimage_t). The image is considered as a two dimensional array. An image in a data list consists of two consecutive data elements, a bounding box followed by a conforming pixel data element. The image tools provide convenient structured access to the data element under the constraints of the bounding box.

The image toolkit contains the following functions: Vfnewim − creates a new image structure, Vfembed − creates an image copy with an optional border set to 0, Vfread reads one image from a file and Vfwrite writes an image to a file.


Vfnewim Initializes an image structure, this is used to create an image array from scratch. All pixels in the image are initialized to the value of 0. The arguments are: the image structure to be initialized, the base data type e.g. VX_PBYTE, the bounding box for the image, and the number of channels in the image. A list structure is allocated that contains the image information and a reference structure is allocated that will be used for convenient image data access.


Vfembed creates a copy of an image in a second image structure. The additional arguments are positive integers that specify a border region of zeros for each of the four sides of the image: x1 adds elements before the start of an image row and x2 adds pixels at the end of an image row. This feature is very useful for local filtering operations since it permits simple access to elements outside the boundary of the original image. To make a direct copy of an image simply set the border values to zero.


Vfread reads a single image from the named file into a Vfstruct. If the file name is null ("") then it will read from standard input. It returns the value 1 for a successful read and 0 if there is no more data in the file or if there is an error in reading the file. It may be called multiple times to read all the images in a file in turn. Once reading a file the pixel type (in .type) should be checked before accessing the data as only one of the pixel type arrays will be created. If no image is found in the file then the type set to VXNULL; any file contents will still be available in .list.


Vfwrite writes an image (actually the whole list) to a file from a Vfstruct. If the file name is set to NULL ("") then the list is written to standard out. Vfwrite may be called multiple times on the same file. Each time a the list will be added to the end of the file.


V3newim,V3embed,V3fread(3), V3fwrite(3)


A. P. Reeves