Package org.ptolemy.opencv
Class ComputerVision
- java.lang.Object
-
- org.ptolemy.opencv.ComputerVision
-
public class ComputerVision extends java.lang.ObjectA set of OpenCV image filters. The parameters of the filter are:- MinFaceSize: Minimum face size to be considered ( one side of a bounding square)
- MaxFaceSize: Maximum face size to be considered ( one side of a bounding square)
- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Elizabeth Osyk, based on FaceRecognizer by Ilga Akkaya
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Yellow (cxh)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classComputerVision.BlurA filter that blurs the image.classComputerVision.DilateA filter that dilates the image.classComputerVision.ErodeA filter that erodes the image.classComputerVision.FindContoursA filter that finds contours in the image.classComputerVision.FindEdgesA filter that finds edges in an image.classComputerVision.GaussianBlurA filter that applies a gaussian blur to an image.classComputerVision.HistogramA class for creating a histogram from the image.classComputerVision.MakeBGRAA filter that converts the image to BGRA format (Blue Green Red Alpha).classComputerVision.MakeGrayA filter that converts the image to grayscale.classComputerVision.MakeHSVA filter that converts the image to HSV (Hue, Saturation, and Value).classComputerVision.MakeYUVA filter that converts the image to YUV.classComputerVision.MedianBlurA filter that blurs the image.
-
Constructor Summary
Constructors Constructor Description ComputerVision()Construct an instance of ComputerVision and load OpenCV.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.opencv.core.MatbufferedImage2Mat(java.awt.image.BufferedImage source)Convert a BufferedImage object to OpenCV's Mat representation.java.awt.image.BufferedImagefilter(java.awt.image.BufferedImage source, java.lang.String filterName)Apply the specified filter to the source image.java.awt.image.BufferedImagemat2BufferedImage(org.opencv.core.Mat matrix)Convert a Mat image into a BufferedImage.voidsetBlurSize(int blurSize)Set the blur size.voidsetCannyThreshold(int threshold)Set the canny edge detection threshold.voidsetErosionSize(int erosionSize)Set the erosion size.java.lang.StringtoString()Return a string description of the filter.
-
-
-
Method Detail
-
filter
public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage source, java.lang.String filterName) throws IllegalActionExceptionApply the specified filter to the source image.- Parameters:
source- The source image to transform.filterName- The name of the filter.- Returns:
- The transformed image.
- Throws:
IllegalActionException- If no filter is found or there is a problem filtering.
-
bufferedImage2Mat
public org.opencv.core.Mat bufferedImage2Mat(java.awt.image.BufferedImage source)
Convert a BufferedImage object to OpenCV's Mat representation.- Parameters:
source- BufferedImage input- Returns:
- Mat matrix
-
mat2BufferedImage
public java.awt.image.BufferedImage mat2BufferedImage(org.opencv.core.Mat matrix)
Convert a Mat image into a BufferedImage.- Parameters:
matrix- Mat input- Returns:
- BufferedImage output
-
setBlurSize
public void setBlurSize(int blurSize)
Set the blur size. 1 to 25.- Parameters:
blurSize- The new blur size.
-
setCannyThreshold
public void setCannyThreshold(int threshold)
Set the canny edge detection threshold. 10 to 150.- Parameters:
threshold- The new threshold
-
setErosionSize
public void setErosionSize(int erosionSize)
Set the erosion size. 0 to 21.- Parameters:
erosionSize- The new erosion size.
-
toString
public java.lang.String toString()
Return a string description of the filter.- Overrides:
toStringin classjava.lang.Object- Returns:
- The string "ComputerVisionFilter".
-
-