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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MatCompute the absolute value of all elements in an array.static MatCompute the bitwise AND of two arrays.static <T> Tstatic <T> TasType(ImageProcessor ip, Class<T> cls) Helper method to convert anImageProcessorto aMatusing Groovy's 'as' syntax.static <T> TasType(BufferedImage img, Class<T> cls) Helper method to convert aBufferedImageto aMat,ImageProcessororImagePlususing Groovy's 'as' syntax.static <T> Tstatic <T> THelper method to convert aMatto aBufferedImage,ImagePlus,ImageProcessor, double or float array using Groovy's 'as' syntax.static MatbitwiseNegate(Mat m1) Compute the bitwise NOT of an array.static MatClip values of a Mat to be within a specified minimum and maximum.static MatDivide array elements by a constant.static MatPer-element division of two arrays.static MatCreate a binary image showing where an array has a specific value.static MatCreate a binary image showing where two arrays have matching values.static MatFlatten a Mat to give a single column.static MatApply a greater than or equal to threshold.static MatApply a greater than or equal to threshold between two arrays.static MatApply a greater than threshold.static MatApply a greater than threshold between two arrays.static MatApply a less than or equal to threshold.static MatApply a less than or equal to threshold between two arrays.static MatApply a less than threshold.static MatApply a less than threshold between two arrays.static doubleFind the maximum of all elements in a Mat, ignoring NaNs.static MatGet the per-element maximum value between an array and a scalar.static MatGet the per-element maximum value for two arrays.static doubleCalculate the mean of all elements in a Mat, ignoring NaNs.static doubleFind the minimum of all elements in a Mat, ignoring NaNs.static MatGet the per-element minimum value between an array and a scalar.static MatGet the per-element minimum value for two arrays.static MatSubtract a constant from an array.static MatSubtract one array from another.static MatSubtract a scalar from an array.static MatMultiply array elements by a constant.static MatPer-element multiplication of two arrays (not matrix multiplication).static MatMultiply elements of an array by -1.static MatCompute the bitwise OR of two arrays.static MatAdd an array and a number.static MatAdd two arrays.static MatAdd an array and a scalar.static MatRaise 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 doubleCalculate the standard deviation of all elements in a Mat, ignoring NaNs.static doubleCalculate the sum of all elements in a Mat, ignoring NaNs.static MatCompute 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:
- Implementation Note
- This uses OpenCV's max function, which seems unreliable with NaNs (the input order matters). This behavior may change in a future version.
-
maximum
Get the per-element maximum value between an array and a scalar.- Parameters:
m1-d-- Returns:
- Implementation Note
- This uses OpenCV's max function, which seems unreliable with NaNs (the input order matters). This behavior may change in a future version.
-
minimum
Get the per-element minimum value between an array and a scalar.- Parameters:
m1-d-- Returns:
- Implementation Note
- This uses OpenCV's min function, which seems unreliable with NaNs (the input order matters). This behavior may change in a future version.
-
minimum
Get the per-element minimum value for two arrays.- Parameters:
m1-m2-- Returns:
- Implementation Note
- This uses OpenCV's min function, which seems unreliable with NaNs (the input order matters). This behavior may change in a future version.
-
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 aMatto aBufferedImage,ImagePlus,ImageProcessor, double or float array using Groovy's 'as' syntax.- Type Parameters:
T-- Parameters:
mat-cls-- Returns:
-
asType
Helper method to convert anImageProcessorto aMatusing Groovy's 'as' syntax.- Type Parameters:
T-- Parameters:
ip-cls-- Returns:
-
asType
- Type Parameters:
T-- Parameters:
imp-cls-- Returns:
-
asType
Helper method to convert aBufferedImageto aMat,ImageProcessororImagePlususing Groovy's 'as' syntax.- Type Parameters:
T-- Parameters:
img-cls-- Returns:
-
asType
- Type Parameters:
T-- Parameters:
n-cls-- Returns:
-