Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To use these functions, the ImageJCV Feature is required.

Fill

convertCV(

Image

ImageCV i, Number

c

newPixelFormat)

 Fills Converts the image with the given colorinput image to another pixel format.

Code Block
languagejs
themesqlEclipse
titleExample
linenumberstrue
output = MAP({expressions=[['convertCVSELECT fill(image, 0.528) FROM Stream
Inv(Image
', 'converted']]}, input)

getWidthCV(ImageCV i)

Inverts Returns the pixel values width of the given image

Code Block
languagejs
themesqlEclipse
titleExample
linenumberstrue
output = MAP({expressions=[['getWidthSELECT inv(image) FROM Stream

Get(Image i, Number x, Number y)

', 'width']]}, input)

getHeightCV(ImageCV i)

Returns the height of the given imageReturn the value of the pixel at the given location

Code Block
languagejs
themesqlEclipse
titleExample
SELECT get(image, 100, 100) FROM Stream

Set(Image i, Number x, Number y, Number c)

linenumberstrue
output = MAP({expressions=[['getHeight(image)', 'height']]}, input)

getDepthCV(ImageCV i)

Returns the depth of the given imageSet the pixel at the given location to the given value

Code Block
languagejs
themeEclipsesql
titleExample
SELECT set(image, 100, 100, 0.5) FROM Stream

Rotate(Image i, Number angle)

Rotates the image at the given angle in degree.

Code Block
languagesql
titleExample
SELECT rotate(image, 90.0) FROM Stream
linenumberstrue
output = MAP({expressions=[['getDepth(image)', 'depth']]}, input)

getNumChannelsCV(ImageCV i)

Returns the number of channels of the given image 

Code Block
languagejs
themeEclipse
titleExample
linenumberstrue
output = MAP({expressions=[['getNumChannels(image)', 'numChannels']]}, input)

getPixelFormatCV(ImageCV i)

Returns the pixel format of the given image

Code Block
languagejs
themeEclipse
titleExample
linenumberstrue
output = MAP({expressions=[['getPixelFormat(image)', 'pixelFormat']]}, input)

resizeCV(ImageCV

Resize(Image

i, Number width, Number height)

Resize Resizes the image to the given width and height

Code Block
languagejs
themesqlEclipse
titleExample
linenumberstrue
output = MAP({expressions=[['resizeCVSELECT resize(image, 500100, 500100) FROM Stream
Sub(Image
', 'smallImage']]}, input)

stretchContrastCV(ImageJCV i, Number

x

oldMin, Number

y

oldMax, Number

width

newMin, Number

height

newMax)

Converts an 16-bit 1-channel image (f.ex. a temperature map) to an 24-bit RGB grayscale image. The contrast of the new image is calculated with this formula for each pixel:

newValue = (oldValue - oldMin) / (oldMax - oldMin) * (newMax - newMin) + newMin

The example converts a temperature map to a grayscale image such that input 1000 maps to black and input 5000 maps to whiteReturns a sub image at the given location and the given width and height.

Code Block
languagejs
themesqlEclipse
titleExample
linenumberstrue
output = MAP({expressions=[['stretchContrastCVSELECT sub(image, 51000, 55000, 2000, 200255) FROM Stream
ToImage(<Number width, Number height>|<Matrix matrix>
', 'grayscale']]}, input)

toImageCV(Number width, Number height)

Creates a new 32-bpp RGBA image with the given width and height

Code Block
languagejs
themeEclipse
titleExample
linenumberstrue
output = MAP({expressions=[['toImageCV(512, 512)', 'image']]}, input)

toImageCV(Number width, Number height, Number depth, Number numChannels, Number pixelFormat)

Creates a new image with the given width, height, depth, channel count and pixel format.

Code Block
languagejs
themesqlEclipse
titleExample
SELECT toImage(500, 500) FROM Stream

ToMatrix(Image i)

Return the pixel values of the given image as a matrix

 

linenumberstrue
output = MAP({expressions=[['toImageCV(512, 512, 8, 4, 28)', 'image']]}, input) /// 32bpp RGBA image

toImageCV(Image i)

Copies the contents of the input image (from the Image feature) into a new ImageJCV image.

Code Block
languagejs
themeEclipse
titleExample
linenumberstrue
output = MAP({expressions=[['toImageCV(inputImage)', 'image']]}, input)

reinterpretCV(ImageJCV i, Number newWidth, Number newHeight, Number newDepth, Number newNumChannels, Number newPixelFormat)

Reinterprets the content of an image (argument 0) as another image with different width, height, depth, number of channels or pixel format. Any parameter which is set to 1 will be replaced by the corresponding value of the original image. Buffer sizes of original and reinterpreted image must match!

Example: Convert a 16-bit grayscale image to a 32-bit RGBA image with half of the width:

Code Block
languagejs
themeEclipse
titleExample
linenumberstrue
output = MAP({expressions=[['reinterpret(image, getWidth(image)/2, -1, 8, 4, 28)', 'image']]}, input)

Parameter explanation:

  • image: Original image
  • getWidth(image)/2: Half width
  • -1: Original height
  • 8: 8 bit per pixel channel
  • 4: 4 channels per pixel
  • 28: 32 Bit RGBA pixel format
 

Table of Contents