Python programming environment compared to VisionX C environment

The VisionX core commands are programed in the C programming language. This language is efficient and with variants such as C++ is used for most industry applications where high run-time performance is an important consideration.

Python is a very popular high-level scripting language that has been used for computer vision research. While it is simple to develop programs, it is much less efficient than C. In many cases, python uses modules programmed in C to improve performance. The main differences between the VisionX C core programming tools and the current python VisionX environment are outlined below.

To access the VisionX interface tools in a python program import the v4 module typically by:


from v4 import vx

VisionX Python Restrictions

  1. Images are implemented with numpy arrays; therefore, the index range must start at zero. Furthermore, the origin for indexing is at the top left corner rather than the traditional lower left corner in VisionX. Hence, increasing the y index goes from top to bottom of the image.
  2. Because of the numpy indexing limitation the index offset must be explicitly included in the index expression when implementing window (convolution) functions.
  3. Command line parsing is implemented with a similar syntax to VisionX other script languages. That is, options that have a minus sign (e.g. -v) are represented by defining a variable with OPT as a prefix (e.g., OPTv). Argument parameters are represented by defining a variable with the prefix name. For example, specifying "of=foo" will create a create a variable called "of" with the value "foo". An important restriction is that one of the most common prefixes used in VisionX is "if=" for the main input file; however, "if" is a reserved word in python and cannot be used as a variable name. To resolve this problem, VisionX remaps an if= parameter to set the variable "vxif" (see Reference for a program example).
  4. Python commands cannot be used as pipes; that is, the input files and output files must be given explicit file names and the command cannot directly read from or write to another command.