---
name: "vop"
section: "1"
platform: "linux"
package: "via-bin"
version: "2.0.4-2"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/vop"
---

# vop(1)

perform arithmetic or logical pixel operation

## NAME

vop - perform arithmetic or logical pixel operation

## SYNOPSIS

**vop -op** *op* **\[-***option* ...\] \[*infile*\] \[*outfile*\]

## DESCRIPTION

**vop** performs arithmetic and logical operations on image pixels. It has three modes:

- 1\.

  It can perform a unary (single-operand) operation on each pixel of an input image.

- 2\.

  It can perform a binary (two-operand) operation between each pixel of an input image and a scalar value.

- 3\.

  It can perform a binary (two-operand) operation between each pixel of an input image and the corresponding pixel of a second image.

The mode, operation, and operands are specified by command line options. Input images come from a data file; the specified operation is performed on each to produce an output image of the same properties.

When the operation is a binary one between two images (case 3, above), the second input comes from a separate file, and it may have...

...the same number of bands as the first input image, in which case band *i* of the output image is formed from band *i* of both input image; or

...a single band, in which case band *i* of the output image is formed from band *i* of the first input image and band 0 of the second.

By means of the **-min** and **-max** options, you can specify bounds for clipping output pixel values.

## COMMAND LINE OPTIONS

**vop** accepts the following options:

- **-help**

  Prints a message describing options.

- **-in** *infile*

  Specifies a Vista data file containing the input images. These images serve as the first operand of a binary operation, or the only operand of a unary one.

- **-out** *outfile*

  Specifies where to write the output images as a Vista data file.

- **-op** *op*

  Specifies the operation as one of the following, described here in terms of operands *u* and *v*:

  ```
  abs	absolute value of u
  exp	exponential function e ** u
  log	natural logarithm log (u)
  not	negation ! u
  sqrt	square root of u
  square	u * u
  add	u + v
  and	u & v
  dist	absolute value of ( u - v )
  div	u / v
  max	max (u, v)
  min	min (u, v)
  mult	u * v
  or	u | v
  sub	u - v
  xor	u ^ v
  ```

- **-value** *number*

  Specifies a scalar constant to be used as the second operand of a binary operation.

- **-image** *imagefile*

  Specifies a Vista data file containing a single image to serve as the second operand of a binary operation.

- **-min** *number*

  Sets a lower bound for clipping output pixel values. Default: the minimum value that can be represented by an output pixel.

- **-max** *number*

  Sets an upper bound for clipping output pixel values. Default: the maximum value that can be represented by an output pixel.

When **-op** specifies a binary operation, either **-image** or **-value** must be specified.

Input and output files can be specified on the command line or allowed to default to the standard input and output streams.

## SEE ALSO

**vadjust**(1Vi), **vconvert**(1Vi), **vinvert**(1Vi), **vnegate**(1Vi),\
 **VImage**(3Vi), **Vista**(7Vi)

## NOTES

The **and**, **or**, and **xor** operations can only be performed with images having integer pixel representations (not **float** or **double**).

A floating point result (such as what **exp** produces) is rounded to the nearest integer for storing in an integer output pixel.

Clipping of output pixel values and arithmetic exceptions are reported by means of warning messages.

## BUGS

If **vop** is built under Solaris 2.x using the unbundled Sun C compiler, an integer division by zero is flagged as a fatal error. This is done because of a SunOS bug that causes those exceptions to repeat indefinitely (see BUGS on the SunOS 5.2 **ieee\_handler**(3M) man page).

If **vop** is built under Solaris 2.x using a compiler other than the unbundled Sun C compiler, there is no reporting of arithmetic exceptions.

## AUTHORS

Ralph Horstmann \<horstman@cs.ubc.ca\>, Art Pope \<pope@cs.ubc.ca\>
