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 SummaryConstructors
- 
Method SummaryModifier 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- 
GroovyCVpublic GroovyCV()
 
- 
- 
Method Details- 
meanCalculate the mean of all elements in a Mat, ignoring NaNs.- Parameters:
- mat-
- Returns:
 
- 
sumCalculate the sum of all elements in a Mat, ignoring NaNs.- Parameters:
- mat-
- Returns:
 
- 
stdCalculate the standard deviation of all elements in a Mat, ignoring NaNs.- Parameters:
- mat-
- Returns:
 
- 
maxFind the maximum of all elements in a Mat, ignoring NaNs.- Parameters:
- mat-
- Returns:
 
- 
minFind the minimum of all elements in a Mat, ignoring NaNs.- Parameters:
- mat-
- Returns:
 
- 
flattenFlatten a Mat to give a single column.- Parameters:
- mat-
- Returns:
 
- 
shapeGet the shape of a multidimensional Mat.- Parameters:
- mat-
- Returns:
 
- 
clipClip values of a Mat to be within a specified minimum and maximum.- Parameters:
- mat-
- min-
- max-
- Returns:
 
- 
maximumGet 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.
 
- 
maximumGet 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.
 
- 
minimumGet 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.
 
- 
minimumGet 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.
 
- 
plusAdd two arrays.- Parameters:
- m1-
- m2-
- Returns:
 
- 
plusAdd an array and a number.- Parameters:
- m1-
- s-
- Returns:
 
- 
plusAdd an array and a scalar.- Parameters:
- m1-
- s-
- Returns:
 
- 
minusSubtract one array from another.- Parameters:
- m1-
- m2-
- Returns:
 
- 
minusSubtract a constant from an array.- Parameters:
- m1-
- s-
- Returns:
 
- 
minusSubtract a scalar from an array.- Parameters:
- m1-
- s-
- Returns:
 
- 
multiplyPer-element multiplication of two arrays (not matrix multiplication).- Parameters:
- m1-
- m2-
- Returns:
 
- 
multiplyMultiply array elements by a constant.- Parameters:
- m1-
- s-
- Returns:
 
- 
divPer-element division of two arrays.- Parameters:
- m1-
- m2-
- Returns:
 
- 
divDivide array elements by a constant.- Parameters:
- m1-
- s-
- Returns:
 
- 
absCompute the absolute value of all elements in an array.- Parameters:
- mat-
- Returns:
 
- 
negativeMultiply elements of an array by -1.- Parameters:
- m1-
- Returns:
 
- 
orCompute the bitwise OR of two arrays.- Parameters:
- m1-
- m2-
- Returns:
 
- 
andCompute the bitwise AND of two arrays.- Parameters:
- m1-
- m2-
- Returns:
 
- 
xorCompute the bitwise XOR of two arrays.- Parameters:
- m1-
- m2-
- Returns:
 
- 
bitwiseNegateCompute the bitwise NOT of an array.- Parameters:
- m1-
- Returns:
 
- 
powerRaise elements of an array to a specified power.- Parameters:
- m1-
- power-
- Returns:
 
- 
splitChannelsSplit channels of an array.- Parameters:
- mat-
- Returns:
 
- 
gtApply a greater than threshold. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
- m1-
- threshold-
- Returns:
 
- 
gtApply a greater than threshold between two arrays. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
- m1-
- m2-
- Returns:
 
- 
eqCreate 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:
 
- 
eqCreate 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:
 
- 
geqApply a greater than or equal to threshold. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
- m1-
- threshold-
- Returns:
 
- 
geqApply 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:
 
- 
ltApply a less than threshold. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
- m1-
- threshold-
- Returns:
 
- 
leqApply 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:
 
- 
leqApply a less than or equal to threshold. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
- m1-
- threshold-
- Returns:
 
- 
ltApply a less than threshold between two arrays. The output is an 8-bit unsigned array with values 0 and 255.- Parameters:
- m1-
- m2-
- Returns:
 
- 
asTypeHelper method to convert aMatto aBufferedImage,ImagePlus,ImageProcessor, double or float array using Groovy's 'as' syntax.- Type Parameters:
- T-
- Parameters:
- mat-
- cls-
- Returns:
 
- 
asTypeHelper method to convert anImageProcessorto aMatusing Groovy's 'as' syntax.- Type Parameters:
- T-
- Parameters:
- ip-
- cls-
- Returns:
 
- 
asType- Type Parameters:
- T-
- Parameters:
- imp-
- cls-
- Returns:
 
- 
asTypeHelper 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:
 
 
-