本文整理汇总了C#中Int32Image.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Int32Image.Dispose方法的具体用法?C# Int32Image.Dispose怎么用?C# Int32Image.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Int32Image
的用法示例。
在下文中一共展示了Int32Image.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindPlate
/* Description:
Find the largest license plate in the image
- Segment using ThresholdHSVchannels
- Remove blobs which are not license plates
Input:
//Original image
RGB888Image plateImage
Output:
//Segmented license plate
ref Int16Image binaryPlateImage
Return:
//License plate found?
bool
*/
public static bool FindPlate(RGB888Image plateImage, ref Int16Image binaryPlateImage, TresholdConditions state)
{
//Constants
int c_threshold_h_min = 0;
int c_threshold_h_max = 0;
int c_threshold_s_min = 0;
int c_threshold_s_max = 0;
int c_threshold_v_min = 0;
int c_threshold_v_max = 0;
int c_remove_blobs_min = 0;
int c_remove_blobs_max = 500;
switch(state)
{
case(TresholdConditions.NORMAAL):
c_threshold_h_min = 21;
c_threshold_h_max = 50;
c_threshold_s_min = 100;
c_threshold_s_max = 255;
c_threshold_v_min = 100;
c_threshold_v_max = 255;
break;
case(TresholdConditions.ONDERBELICHT):
c_threshold_h_min = 11;
c_threshold_h_max = 119;
c_threshold_s_min = 23;
c_threshold_s_max = 255;
c_threshold_v_min = 56;
c_threshold_v_max = 176;
break;
case(TresholdConditions.OVERBELICHT):
c_threshold_h_min = 0;
c_threshold_h_max = 241;
c_threshold_s_min = 29;
c_threshold_s_max = 241;
c_threshold_v_min = 249;
c_threshold_v_max = 255;
break;
}
//*******************************//
//** Exercise: **//
//** adjust licenseplate **//
//** segmentation **//
//*******************************//
//Find licenseplate
HSV888Image plateImageHSV = new HSV888Image();
//Convert to RGB to HSV
VisionLab.FastRGBToHSV(plateImage, plateImageHSV);
//Threshold HSV image
VisionLab.Threshold3Channels(plateImageHSV, binaryPlateImage, c_threshold_h_min, c_threshold_h_max, c_threshold_s_min, c_threshold_s_max, c_threshold_v_min, c_threshold_v_max);
//Convert to a 32 bit format
Int32Image binaryPlateImage32 = new Int32Image();
VisionLab.Convert(binaryPlateImage, binaryPlateImage32);
//Remove blobs with small areas
VisionLab.RemoveBlobs(binaryPlateImage32, Connected.EightConnected, BlobAnalyse.BA_Area, c_remove_blobs_min, c_remove_blobs_max);
//Remove border blobs
VisionLab.RemoveBorderBlobs(binaryPlateImage32, Connected.EightConnected, Border.AllBorders);
//Length Breath Ratio
VisionLab.RemoveBlobs(binaryPlateImage32, Connected.EightConnected, BlobAnalyse.BA_LengthBreadthRatio, 0, 2.5);
VisionLab.RemoveBlobs(binaryPlateImage32, Connected.EightConnected, BlobAnalyse.BA_LengthBreadthRatio, 6.7, 10);
// Remove blobs that have to less holes
VisionLab.RemoveBlobs(binaryPlateImage32, Connected.EightConnected, BlobAnalyse.BA_NrOfHoles, 0, 5);
// And remove blobs that have a to small area for the holes
VisionLab.RemoveBlobs(binaryPlateImage32, Connected.EightConnected, BlobAnalyse.BA_AreaHoles, 0, 200);
//Convert back to a 16 bit format
VisionLab.Convert(binaryPlateImage32, binaryPlateImage);
//binPlateImage32.Dispose();
binaryPlateImage32.Dispose();
plateImageHSV.Dispose();
GC.Collect();
//Return true, if pixels found
return (VisionLab.SumIntPixels(binaryPlateImage) > 0);
//return VisionLab.LabelBlobs(binaryPlateImage, Connected.EightConnected) == 1;
}
示例2: image
/* Description:
Locates the characters of the license plate
- Warp image (Rectify)
- Segment characters
- Remove blobs which are to small (Lines between characters)
Input:
//Original image
RGB888Image plateImage
//Segmented license plate
Int16Image binaryPlateImage
Output:
//Image containing binary six characters
ref Int16Image binaryCharacterImage
Return:
//Function executed successfully
bool
*/
public static bool FindCharacters(RGB888Image plateImage, Int16Image binaryPlateImage, ref Int16Image binaryCharacterImage)
{
//Constants
const int c_height = 100;
const int c_width = 470;
const int c_remove_blobs_min = 0;
const int c_remove_blobs_max = 400;
XYCoord leftTop = new XYCoord();
XYCoord rightTop = new XYCoord();
XYCoord leftBottom = new XYCoord();
XYCoord rightBottom = new XYCoord();
// 2de set coordinaten:
// NIEUW
XYCoord leftTop2 = new XYCoord();
XYCoord rightTop2 = new XYCoord();
XYCoord leftBottom2 = new XYCoord();
XYCoord rightBottom2 = new XYCoord();
//Find licenseplate
Int32Image binaryPlateImage32 = new Int32Image();
VisionLab.Convert(binaryPlateImage, binaryPlateImage32);
VisionLab.FindCornersRectangle(
binaryPlateImage32,
Connected.EightConnected,
0.5,
Orientation.Landscape,
leftTop,
rightTop,
leftBottom,
rightBottom
);
// NIEUW
// Coordinaten bepalen voor deze functie
VisionLab.FindCornersRectangleSq(
binaryPlateImage32,
Connected.EightConnected,
leftTop2,
rightTop2,
leftBottom2,
rightBottom2
);
binaryPlateImage32.Dispose();
Int16Image plateImageGray = new Int16Image();
VisionLab.Convert(plateImage, plateImageGray);
binaryCharacterImage.Assign_Op(plateImageGray);
// Eerst de standaard wrap proberen
try
{
//Rectify plate
VisionLab.Warp(
plateImageGray,
binaryCharacterImage,
TransformDirection.ForwardT,
new Coord2D(leftTop),
new Coord2D(rightTop),
new Coord2D(leftBottom),
new Coord2D(rightBottom),
c_height,
c_width,
0
);
}
catch (Exception )
{
// NIEUW
// Als dat mislukt dan de andere gebruiken
try
{
VisionLab.Warp(plateImageGray,
binaryCharacterImage,
TransformDirection.ForwardT,
new Coord2D(leftTop2),
new Coord2D(rightTop2),
new Coord2D(leftBottom2),
new Coord2D(rightBottom2),
//.........这里部分代码省略.........