C# Класс OpenCvSharp.Blob.CvBlobLib

Functions of cvblob library
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
BlobMeanColor ( CvBlobs blobs, CvBlob targetBlob, Mat originalImage ) : Scalar

Calculates mean color of a blob in an image.

CalcAngle ( CvBlob blob ) : double

Calculates angle orientation of a blob. This function uses central moments so cvCentralMoments should have been called before for this blob. (cvAngle)

CalcCentroid ( CvBlob blob ) : Point2d

Calculates centroid. Centroid will be returned and stored in the blob structure. (cvCentroid)

ContourChainCodePerimeter ( CvContourChainCode cc ) : double

Calculates perimeter of a chain code contour.

ContourPolygonArea ( CvContourPolygon polygon ) : double

Calculates area of a polygonal contour.

ContourPolygonCircularity ( CvContourPolygon polygon ) : double

Calculates the circularity of a polygon (compactness measure).

ContourPolygonPerimeter ( CvContourPolygon polygon ) : double

Calculates perimeter of a chain code contour.

ConvertChainCodesToPolygon ( CvContourChainCode cc ) : CvContourPolygon

Convert a chain code contour to a polygon.

FilterByArea ( CvBlobs blobs, int minArea, int maxArea ) : void

Filter blobs by area. Those blobs whose areas are not in range will be erased from the input list of blobs. (cvFilterByArea)

FilterByLabel ( CvBlobs blobs, int label ) : void

Filter blobs by label. Delete all blobs except those with label l.

FilterLabels ( CvBlobs blobs, Mat imgOut ) : void

Draw a binary image with the blobs that have been given. (cvFilterLabels)

GetLabel ( CvBlobs blobs, int x, int y ) : int

Get the label value from a labeled image.

GreaterBlob ( CvBlobs blobs ) : CvBlob

Find greater blob. (cvGreaterBlob)

Label ( Mat img, CvBlobs blobs ) : int

Label the connected parts of a binary image. (cvLabel)

LargestBlob ( CvBlobs blobs ) : CvBlob

Find the largest blob. (cvLargestBlob)

PolygonContourConvexHull ( CvContourPolygon polygon ) : CvContourPolygon

Calculates convex hull of a contour. Uses the Melkman Algorithm. Code based on the version in http://w3.impa.br/~rdcastan/Cgeometry/.

RenderBlob ( LabelData labels, CvBlob blob, Mat imgSource, Mat imgDest ) : void

Draws or prints information about a blob.

RenderBlob ( LabelData labels, CvBlob blob, Mat imgSource, Mat imgDest, RenderBlobsMode mode ) : void

Draws or prints information about a blob.

RenderBlob ( LabelData labels, CvBlob blob, Mat imgSource, Mat imgDest, RenderBlobsMode mode, Scalar color, double alpha = 1.0 ) : void

Draws or prints information about a blob.

RenderBlobs ( CvBlobs blobs, Mat imgSource, Mat imgDest ) : void

Draws or prints information about blobs. (cvRenderBlobs)

RenderBlobs ( CvBlobs blobs, Mat imgSource, Mat imgDest, RenderBlobsMode mode, double alpha = 1.0 ) : void

Draws or prints information about blobs. (cvRenderBlobs)

RenderContourChainCode ( CvContourChainCode contour, Mat img ) : void

Draw a contour.

RenderContourChainCode ( CvContourChainCode contour, Mat img, Scalar color ) : void

Draw a contour.

RenderContourPolygon ( CvContourPolygon contour, Mat img ) : void

Draw a polygon.

RenderContourPolygon ( CvContourPolygon contour, Mat img, Scalar color ) : void

Draw a polygon.

RenderTracks ( CvTracks tracks, Mat imgSource, Mat imgDest ) : void

Prints tracks information.

RenderTracks ( CvTracks tracks, Mat imgSource, Mat imgDest, RenderTracksMode mode ) : void

Prints tracks information.

RenderTracks ( CvTracks tracks, Mat imgSource, Mat imgDest, RenderTracksMode mode, Scalar textColor, HersheyFonts fontFace = HersheyFonts.HersheySimplex, double fontScale = 1d, int thickness = 1 ) : void

Prints tracks information.

SaveImageBlob ( string fileName, Mat img, CvBlob blob ) : void

Save the image of a blob to a file. The function uses an image (that can be the original pre-processed image or a processed one, or even the result of cvRenderBlobs, for example) and a blob structure. Then the function saves a copy of the part of the image where the blob is.

SimplifyPolygon ( CvContourPolygon polygon ) : CvContourPolygon

Simplify a polygon reducing the number of vertex according the distance "delta". Uses a version of the Ramer-Douglas-Peucker algorithm (http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm).

SimplifyPolygon ( CvContourPolygon polygon, double delta ) : CvContourPolygon

Simplify a polygon reducing the number of vertex according the distance "delta". Uses a version of the Ramer-Douglas-Peucker algorithm (http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm).

UpdateTracks ( CvBlobs blobs, CvTracks tracks, double thDistance, int thInactive ) : void

Updates list of tracks based on current blobs.

UpdateTracks ( CvBlobs blobs, CvTracks tracks, double thDistance, int thInactive, int thActive ) : void

Updates list of tracks based on current blobs.

Tracking based on: A. Senior, A. Hampapur, Y-L Tian, L. Brown, S. Pankanti, R. Bolle. Appearance Models for Occlusion Handling. Second International workshop on Performance Evaluation of Tracking and Surveillance Systems & CVPR'01. December, 2001. (http://www.research.ibm.com/peoplevision/PETS2001.pdf)

WriteContourPolygonCsv ( CvContourPolygon polygon, string filename ) : void

Write a contour to a CSV (Comma-separated values) file.

WriteContourPolygonSvg ( CvContourPolygon polygon, string fileName ) : void

Write a contour to a SVG file.

WriteContourPolygonSvg ( CvContourPolygon polygon, string fileName, Scalar stroke, Scalar fill ) : void

Write a contour to a SVG file.

Описание методов

BlobMeanColor() публичный статический Метод

Calculates mean color of a blob in an image.
public static BlobMeanColor ( CvBlobs blobs, CvBlob targetBlob, Mat originalImage ) : Scalar
blobs CvBlobs Blob list
targetBlob CvBlob The target blob
originalImage Mat Original image.
Результат Scalar

CalcAngle() публичный статический Метод

Calculates angle orientation of a blob. This function uses central moments so cvCentralMoments should have been called before for this blob. (cvAngle)
public static CalcAngle ( CvBlob blob ) : double
blob CvBlob Blob.
Результат double

CalcCentroid() публичный статический Метод

Calculates centroid. Centroid will be returned and stored in the blob structure. (cvCentroid)
public static CalcCentroid ( CvBlob blob ) : Point2d
blob CvBlob Blob whose centroid will be calculated.
Результат Point2d

ContourChainCodePerimeter() публичный статический Метод

Calculates perimeter of a chain code contour.
public static ContourChainCodePerimeter ( CvContourChainCode cc ) : double
cc CvContourChainCode Contour (chain code type).
Результат double

ContourPolygonArea() публичный статический Метод

Calculates area of a polygonal contour.
public static ContourPolygonArea ( CvContourPolygon polygon ) : double
polygon CvContourPolygon Contour (polygon type).
Результат double

ContourPolygonCircularity() публичный статический Метод

Calculates the circularity of a polygon (compactness measure).
public static ContourPolygonCircularity ( CvContourPolygon polygon ) : double
polygon CvContourPolygon Contour (polygon type).
Результат double

ContourPolygonPerimeter() публичный статический Метод

Calculates perimeter of a chain code contour.
public static ContourPolygonPerimeter ( CvContourPolygon polygon ) : double
polygon CvContourPolygon Contour (polygon type).
Результат double

ConvertChainCodesToPolygon() публичный статический Метод

Convert a chain code contour to a polygon.
public static ConvertChainCodesToPolygon ( CvContourChainCode cc ) : CvContourPolygon
cc CvContourChainCode Chain code contour.
Результат CvContourPolygon

FilterByArea() публичный статический Метод

Filter blobs by area. Those blobs whose areas are not in range will be erased from the input list of blobs. (cvFilterByArea)
public static FilterByArea ( CvBlobs blobs, int minArea, int maxArea ) : void
blobs CvBlobs List of blobs.
minArea int Minimun area.
maxArea int Maximun area.
Результат void

FilterByLabel() публичный статический Метод

Filter blobs by label. Delete all blobs except those with label l.
public static FilterByLabel ( CvBlobs blobs, int label ) : void
blobs CvBlobs List of blobs.
label int Label to leave.
Результат void

FilterLabels() публичный статический Метод

Draw a binary image with the blobs that have been given. (cvFilterLabels)
public static FilterLabels ( CvBlobs blobs, Mat imgOut ) : void
blobs CvBlobs List of blobs to be drawn.
imgOut Mat Output binary image (depth=IPL_DEPTH_8U and nchannels=1).
Результат void

GetLabel() публичный статический Метод

Get the label value from a labeled image.
public static GetLabel ( CvBlobs blobs, int x, int y ) : int
blobs CvBlobs Blob data.
x int X coordenate.
y int Y coordenate.
Результат int

GreaterBlob() публичный статический Метод

Find greater blob. (cvGreaterBlob)
public static GreaterBlob ( CvBlobs blobs ) : CvBlob
blobs CvBlobs List of blobs.
Результат CvBlob

Label() публичный статический Метод

Label the connected parts of a binary image. (cvLabel)
public static Label ( Mat img, CvBlobs blobs ) : int
img Mat Input binary image (depth=IPL_DEPTH_8U and num. channels=1).
blobs CvBlobs List of blobs.
Результат int

LargestBlob() публичный статический Метод

Find the largest blob. (cvLargestBlob)
public static LargestBlob ( CvBlobs blobs ) : CvBlob
blobs CvBlobs List of blobs.
Результат CvBlob

PolygonContourConvexHull() публичный статический Метод

Calculates convex hull of a contour. Uses the Melkman Algorithm. Code based on the version in http://w3.impa.br/~rdcastan/Cgeometry/.
public static PolygonContourConvexHull ( CvContourPolygon polygon ) : CvContourPolygon
polygon CvContourPolygon Contour (polygon type).
Результат CvContourPolygon

RenderBlob() публичный статический Метод

Draws or prints information about a blob.
public static RenderBlob ( LabelData labels, CvBlob blob, Mat imgSource, Mat imgDest ) : void
labels LabelData Label data.
blob CvBlob Blob.
imgSource Mat Input image (depth=IPL_DEPTH_8U and num. channels=3).
imgDest Mat Output image (depth=IPL_DEPTH_8U and num. channels=3).
Результат void

RenderBlob() публичный статический Метод

Draws or prints information about a blob.
public static RenderBlob ( LabelData labels, CvBlob blob, Mat imgSource, Mat imgDest, RenderBlobsMode mode ) : void
labels LabelData Label data.
blob CvBlob Blob.
imgSource Mat Input image (depth=IPL_DEPTH_8U and num. channels=3).
imgDest Mat Output image (depth=IPL_DEPTH_8U and num. channels=3).
mode RenderBlobsMode Render mode. By default is CV_BLOB_RENDER_COLOR|CV_BLOB_RENDER_CENTROID|CV_BLOB_RENDER_BOUNDING_BOX|CV_BLOB_RENDER_ANGLE.
Результат void

RenderBlob() публичный статический Метод

Draws or prints information about a blob.
public static RenderBlob ( LabelData labels, CvBlob blob, Mat imgSource, Mat imgDest, RenderBlobsMode mode, Scalar color, double alpha = 1.0 ) : void
labels LabelData Label data.
blob CvBlob Blob.
imgSource Mat Input image (depth=IPL_DEPTH_8U and num. channels=3).
imgDest Mat Output image (depth=IPL_DEPTH_8U and num. channels=3).
mode RenderBlobsMode Render mode. By default is CV_BLOB_RENDER_COLOR|CV_BLOB_RENDER_CENTROID|CV_BLOB_RENDER_BOUNDING_BOX|CV_BLOB_RENDER_ANGLE.
color Scalar Color to render (if CV_BLOB_RENDER_COLOR is used).
alpha double If mode CV_BLOB_RENDER_COLOR is used. 1.0 indicates opaque and 0.0 translucent (1.0 by default).
Результат void

RenderBlobs() публичный статический Метод

Draws or prints information about blobs. (cvRenderBlobs)
public static RenderBlobs ( CvBlobs blobs, Mat imgSource, Mat imgDest ) : void
blobs CvBlobs List of blobs.
imgSource Mat Input image (depth=IPL_DEPTH_8U and num. channels=3).
imgDest Mat Output image (depth=IPL_DEPTH_8U and num. channels=3).
Результат void

RenderBlobs() публичный статический Метод

Draws or prints information about blobs. (cvRenderBlobs)
public static RenderBlobs ( CvBlobs blobs, Mat imgSource, Mat imgDest, RenderBlobsMode mode, double alpha = 1.0 ) : void
blobs CvBlobs List of blobs.
imgSource Mat Input image (depth=IPL_DEPTH_8U and num. channels=3).
imgDest Mat Output image (depth=IPL_DEPTH_8U and num. channels=3).
mode RenderBlobsMode Render mode. By default is CV_BLOB_RENDER_COLOR|CV_BLOB_RENDER_CENTROID|CV_BLOB_RENDER_BOUNDING_BOX|CV_BLOB_RENDER_ANGLE.
alpha double If mode CV_BLOB_RENDER_COLOR is used. 1.0 indicates opaque and 0.0 translucent (1.0 by default).
Результат void

RenderContourChainCode() публичный статический Метод

Draw a contour.
public static RenderContourChainCode ( CvContourChainCode contour, Mat img ) : void
contour CvContourChainCode Chain code contour.
img Mat Image to draw on.
Результат void

RenderContourChainCode() публичный статический Метод

Draw a contour.
public static RenderContourChainCode ( CvContourChainCode contour, Mat img, Scalar color ) : void
contour CvContourChainCode Chain code contour.
img Mat Image to draw on.
color Scalar Color to draw (default, white).
Результат void

RenderContourPolygon() публичный статический Метод

Draw a polygon.
public static RenderContourPolygon ( CvContourPolygon contour, Mat img ) : void
contour CvContourPolygon Polygon contour.
img Mat Image to draw on.
Результат void

RenderContourPolygon() публичный статический Метод

Draw a polygon.
public static RenderContourPolygon ( CvContourPolygon contour, Mat img, Scalar color ) : void
contour CvContourPolygon Polygon contour.
img Mat Image to draw on.
color Scalar Color to draw (default, white).
Результат void

RenderTracks() публичный статический Метод

Prints tracks information.
public static RenderTracks ( CvTracks tracks, Mat imgSource, Mat imgDest ) : void
tracks CvTracks List of tracks.
imgSource Mat Input image (depth=IPL_DEPTH_8U and num. channels=3).
imgDest Mat Output image (depth=IPL_DEPTH_8U and num. channels=3).
Результат void

RenderTracks() публичный статический Метод

Prints tracks information.
public static RenderTracks ( CvTracks tracks, Mat imgSource, Mat imgDest, RenderTracksMode mode ) : void
tracks CvTracks List of tracks.
imgSource Mat Input image (depth=IPL_DEPTH_8U and num. channels=3).
imgDest Mat Output image (depth=IPL_DEPTH_8U and num. channels=3).
mode RenderTracksMode Render mode. By default is CV_TRACK_RENDER_ID.
Результат void

RenderTracks() публичный статический Метод

Prints tracks information.
public static RenderTracks ( CvTracks tracks, Mat imgSource, Mat imgDest, RenderTracksMode mode, Scalar textColor, HersheyFonts fontFace = HersheyFonts.HersheySimplex, double fontScale = 1d, int thickness = 1 ) : void
tracks CvTracks List of tracks.
imgSource Mat Input image (depth=IPL_DEPTH_8U and num. channels=3).
imgDest Mat Output image (depth=IPL_DEPTH_8U and num. channels=3).
mode RenderTracksMode Render mode. By default is CV_TRACK_RENDER_ID.
textColor Scalar
fontFace HersheyFonts
fontScale double
thickness int
Результат void

SaveImageBlob() публичный статический Метод

Save the image of a blob to a file. The function uses an image (that can be the original pre-processed image or a processed one, or even the result of cvRenderBlobs, for example) and a blob structure. Then the function saves a copy of the part of the image where the blob is.
public static SaveImageBlob ( string fileName, Mat img, CvBlob blob ) : void
fileName string Name of the file.
img Mat Image.
blob CvBlob Blob.
Результат void

SimplifyPolygon() публичный статический Метод

Simplify a polygon reducing the number of vertex according the distance "delta". Uses a version of the Ramer-Douglas-Peucker algorithm (http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm).
public static SimplifyPolygon ( CvContourPolygon polygon ) : CvContourPolygon
polygon CvContourPolygon Contour (polygon type).
Результат CvContourPolygon

SimplifyPolygon() публичный статический Метод

Simplify a polygon reducing the number of vertex according the distance "delta". Uses a version of the Ramer-Douglas-Peucker algorithm (http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm).
public static SimplifyPolygon ( CvContourPolygon polygon, double delta ) : CvContourPolygon
polygon CvContourPolygon Contour (polygon type).
delta double Minimun distance.
Результат CvContourPolygon

UpdateTracks() публичный статический Метод

Updates list of tracks based on current blobs.
public static UpdateTracks ( CvBlobs blobs, CvTracks tracks, double thDistance, int thInactive ) : void
blobs CvBlobs List of blobs.
tracks CvTracks List of tracks.
thDistance double Max distance to determine when a track and a blob match.
thInactive int Max number of frames a track can be inactive.
Результат void

UpdateTracks() публичный статический Метод

Updates list of tracks based on current blobs.
Tracking based on: A. Senior, A. Hampapur, Y-L Tian, L. Brown, S. Pankanti, R. Bolle. Appearance Models for Occlusion Handling. Second International workshop on Performance Evaluation of Tracking and Surveillance Systems & CVPR'01. December, 2001. (http://www.research.ibm.com/peoplevision/PETS2001.pdf)
public static UpdateTracks ( CvBlobs blobs, CvTracks tracks, double thDistance, int thInactive, int thActive ) : void
blobs CvBlobs List of blobs.
tracks CvTracks List of tracks.
thDistance double Max distance to determine when a track and a blob match.
thInactive int Max number of frames a track can be inactive.
thActive int If a track becomes inactive but it has been active less than thActive frames, the track will be deleted.
Результат void

WriteContourPolygonCsv() публичный статический Метод

Write a contour to a CSV (Comma-separated values) file.
public static WriteContourPolygonCsv ( CvContourPolygon polygon, string filename ) : void
polygon CvContourPolygon Polygon contour.
filename string File name.
Результат void

WriteContourPolygonSvg() публичный статический Метод

Write a contour to a SVG file.
public static WriteContourPolygonSvg ( CvContourPolygon polygon, string fileName ) : void
polygon CvContourPolygon Polygon contour.
fileName string File name.
Результат void

WriteContourPolygonSvg() публичный статический Метод

Write a contour to a SVG file.
public static WriteContourPolygonSvg ( CvContourPolygon polygon, string fileName, Scalar stroke, Scalar fill ) : void
polygon CvContourPolygon Polygon contour.
fileName string File name.
stroke Scalar Stroke color (black by default).
fill Scalar Fill color (white by default).
Результат void