Package qupath.opencv.tools
Class GroovyCV
java.lang.Object
qupath.opencv.tools.GroovyCV
Category class for enhanced Groovy scripting with OpenCV.
See https://docs.groovy-lang.org/latest/html/api/groovy/lang/Category.html
Warning! This is experimental and likely to change between QuPath releases. Use with caution and discuss on http://forum.image.sc/tag/qupath
- Author:
- Pete Bankhead
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Mat
Compute the absolute value of all elements in an array.static Mat
Compute the bitwise AND of two arrays.static <T> T
static <T> T
asType
(ImageProcessor ip, Class<T> cls) Helper method to convert anImageProcessor
to aMat
using Groovy's 'as' syntax.static <T> T
asType
(BufferedImage img, Class<T> cls) Helper method to convert aBufferedImage
to aMat
,ImageProcessor
orImagePlus
using Groovy's 'as' syntax.static <T> T
static <T> T
Helper method to convert aMat
to aBufferedImage
,ImagePlus
,ImageProcessor
, double or float array using Groovy's 'as' syntax.static Mat
bitwiseNegate
(Mat m1) Compute the bitwise NOT of an array.static Mat
Clip values of a Mat to be within a specified minimum and maximum.static Mat
Divide array elements by a constant.static Mat
Per-element division of two arrays.static Mat
Create a binary image showing where an array has a specific value.static Mat
Create a binary image showing where two arrays have matching values.static Mat
Flatten a Mat to give a single column.static Mat
Apply a greater than or equal to threshold.static Mat
Apply a greater than or equal to threshold between two arrays.static Mat
Apply a greater than threshold.static Mat
Apply a greater than threshold between two arrays.static Mat
Apply a less than or equal to threshold.static Mat
Apply a less than or equal to threshold between two arrays.static Mat
Apply a less than threshold.static Mat
Apply a less than threshold between two arrays.static double
Find the maximum of all elements in a Mat, ignoring NaNs.static Mat
Get the per-element maximum value between an array and a scalar.static Mat
Get the per-element maximum value for two arrays.static double
Calculate the mean of all elements in a Mat, ignoring NaNs.static double
Find the minimum of all elements in a Mat, ignoring NaNs.static Mat
Get the per-element minimum value between an array and a scalar.static Mat
Get the per-element minimum value for two arrays.static Mat
Subtract a constant from an array.static Mat
Subtract one array from another.static Mat
Subtract a scalar from an array.static Mat
Multiply array elements by a constant.static Mat
Per-element multiplication of two arrays (not matrix multiplication).static Mat
Multiply elements of an array by -1.static Mat
Compute the bitwise OR of two arrays.static Mat
Add an array and a number.static Mat
Add two arrays.static Mat
Add an array and a scalar.static Mat
Raise elements of an array to a specified power.static long[]
Get the shape of a multidimensional Mat.splitChannels
(Mat mat) Split channels of an array.static double
Calculate the standard deviation of all elements in a Mat, ignoring NaNs.static double
Calculate the sum of all elements in a Mat, ignoring NaNs.static Mat
Compute the bitwise XOR of two arrays.
-
Constructor Details
-
GroovyCV
public GroovyCV()
-
-
Method Details
-
mean
Calculate the mean of all elements in a Mat, ignoring NaNs.- Parameters:
mat
-- Returns:
-
sum
Calculate the sum of all elements in a Mat, ignoring NaNs.- Parameters:
mat
-- Returns:
-
std
Calculate the standard deviation of all elements in a Mat, ignoring NaNs.- Parameters:
mat
-- Returns:
-
max
Find the maximum of all elements in a Mat, ignoring NaNs.- Parameters:
mat
-- Returns:
-
min
Find the minimum of all elements in a Mat, ignoring NaNs.- Parameters:
mat
-- Returns:
-
flatten
Flatten a Mat to give a single column.- Parameters:
mat
-- Returns:
-
shape
Get the shape of a multidimensional Mat.- Parameters:
mat
-- Returns:
-
clip
Clip values of a Mat to be within a specified minimum and maximum.- Parameters:
mat
-min
-max
-- Returns:
-
maximum
Get the per-element maximum value for two arrays.- Parameters:
m1
-m2
-- Returns:
-
maximum
Get the per-element maximum value between an array and a scalar.- Parameters:
m1
-d
-- Returns:
-
minimum
Get the per-element minimum value between an array and a scalar.- Parameters:
m1
-d
-- Returns:
-
minimum
Get the per-element minimum value for two arrays.- Parameters:
m1
-m2
-- Returns:
-
plus
Add two arrays.- Parameters:
m1
-m2
-- Returns:
-
plus
Add an array and a number.- Parameters:
m1
-s
-- Returns:
-
plus
Add an array and a scalar.- Parameters:
m1
-s
-- Returns:
-
minus
Subtract one array from another.- Parameters:
m1
-m2
-- Returns:
-
minus
Subtract a constant from an array.- Parameters:
m1
-s
-- Returns:
-
minus
Subtract a scalar from an array.- Parameters:
m1
-s
-- Returns:
-
multiply
Per-element multiplication of two arrays (not matrix multiplication).- Parameters:
m1
-m2
-- Returns:
-
multiply
Multiply array elements by a constant.- Parameters:
m1
-s
-- Returns:
-
div
Per-element division of two arrays.- Parameters:
m1
-m2
-- Returns:
-
div
Divide array elements by a constant.- Parameters:
m1
-s
-- Returns:
-
abs
Compute the absolute value of all elements in an array.- Parameters:
mat
-- Returns:
-
negative
Multiply elements of an array by -1.- Parameters:
m1
-- Returns:
-
or
Compute the bitwise OR of two arrays.- Parameters:
m1
-m2
-- Returns:
-
and
Compute the bitwise AND of two arrays.- Parameters:
m1
-m2
-- Returns:
-
xor
Compute the bitwise XOR of two arrays.- Parameters:
m1
-m2
-- Returns:
-
bitwiseNegate
Compute the bitwise NOT of an array.- Parameters:
m1
-- Returns:
-
power
Raise elements of an array to a specified power.- Parameters:
m1
-power
-- Returns:
-
splitChannels
Split channels of an array.- Parameters:
mat
-- Returns:
-
gt
Apply a greater than threshold. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
m1
-threshold
-- Returns:
-
gt
Apply a greater than threshold between two arrays. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
m1
-m2
-- Returns:
-
eq
Create a binary image showing where an array has a specific value. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
m1
-value
-- Returns:
-
eq
Create a binary image showing where two arrays have matching values. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
m1
-m2
-- Returns:
-
geq
Apply a greater than or equal to threshold. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
m1
-threshold
-- Returns:
-
geq
Apply a greater than or equal to threshold between two arrays. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
m1
-m2
-- Returns:
-
lt
Apply a less than threshold. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
m1
-threshold
-- Returns:
-
leq
Apply a less than or equal to threshold between two arrays. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
m1
-m2
-- Returns:
-
leq
Apply a less than or equal to threshold. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
m1
-threshold
-- Returns:
-
lt
Apply a less than threshold between two arrays. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
m1
-m2
-- Returns:
-
asType
Helper method to convert aMat
to aBufferedImage
,ImagePlus
,ImageProcessor
, double or float array using Groovy's 'as' syntax.- Type Parameters:
T
-- Parameters:
mat
-cls
-- Returns:
-
asType
Helper method to convert anImageProcessor
to aMat
using Groovy's 'as' syntax.- Type Parameters:
T
-- Parameters:
ip
-cls
-- Returns:
-
asType
- Type Parameters:
T
-- Parameters:
imp
-cls
-- Returns:
-
asType
Helper method to convert aBufferedImage
to aMat
,ImageProcessor
orImagePlus
using Groovy's 'as' syntax.- Type Parameters:
T
-- Parameters:
img
-cls
-- Returns:
-
asType
- Type Parameters:
T
-- Parameters:
n
-cls
-- Returns:
-