Package org.ptolemy.opencv
Class ComputerVision
- java.lang.Object
-
- org.ptolemy.opencv.ComputerVision
-
public class ComputerVision extends java.lang.Object
A 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 class
ComputerVision.Blur
A filter that blurs the image.class
ComputerVision.Dilate
A filter that dilates the image.class
ComputerVision.Erode
A filter that erodes the image.class
ComputerVision.FindContours
A filter that finds contours in the image.class
ComputerVision.FindEdges
A filter that finds edges in an image.class
ComputerVision.GaussianBlur
A filter that applies a gaussian blur to an image.class
ComputerVision.Histogram
A class for creating a histogram from the image.class
ComputerVision.MakeBGRA
A filter that converts the image to BGRA format (Blue Green Red Alpha).class
ComputerVision.MakeGray
A filter that converts the image to grayscale.class
ComputerVision.MakeHSV
A filter that converts the image to HSV (Hue, Saturation, and Value).class
ComputerVision.MakeYUV
A filter that converts the image to YUV.class
ComputerVision.MedianBlur
A 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.Mat
bufferedImage2Mat(java.awt.image.BufferedImage source)
Convert a BufferedImage object to OpenCV's Mat representation.java.awt.image.BufferedImage
filter(java.awt.image.BufferedImage source, java.lang.String filterName)
Apply the specified filter to the source image.java.awt.image.BufferedImage
mat2BufferedImage(org.opencv.core.Mat matrix)
Convert a Mat image into a BufferedImage.void
setBlurSize(int blurSize)
Set the blur size.void
setCannyThreshold(int threshold)
Set the canny edge detection threshold.void
setErosionSize(int erosionSize)
Set the erosion size.java.lang.String
toString()
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 IllegalActionException
Apply 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:
toString
in classjava.lang.Object
- Returns:
- The string "ComputerVisionFilter".
-
-