mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 19:52:50 +08:00
minor code cleanup
This commit is contained in:
@@ -71,8 +71,8 @@ namespace openalprnet_windemo
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int width = 0;
|
var width = 0;
|
||||||
int height = 0;
|
var height = 0;
|
||||||
|
|
||||||
foreach (var bmp in images)
|
foreach (var bmp in images)
|
||||||
{
|
{
|
||||||
@@ -81,20 +81,20 @@ namespace openalprnet_windemo
|
|||||||
}
|
}
|
||||||
|
|
||||||
//create a bitmap to hold the combined image
|
//create a bitmap to hold the combined image
|
||||||
finalImage = new System.Drawing.Bitmap(width, height);
|
finalImage = new Bitmap(width, height);
|
||||||
|
|
||||||
//get a graphics object from the image so we can draw on it
|
//get a graphics object from the image so we can draw on it
|
||||||
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(finalImage))
|
using (var g = Graphics.FromImage(finalImage))
|
||||||
{
|
{
|
||||||
//set background color
|
//set background color
|
||||||
g.Clear(System.Drawing.Color.Black);
|
g.Clear(Color.Black);
|
||||||
|
|
||||||
//go through each image and draw it on the final image
|
//go through each image and draw it on the final image
|
||||||
int offset = 0;
|
var offset = 0;
|
||||||
foreach (System.Drawing.Bitmap image in images)
|
foreach (Bitmap image in images)
|
||||||
{
|
{
|
||||||
g.DrawImage(image,
|
g.DrawImage(image,
|
||||||
new System.Drawing.Rectangle(offset, 0, image.Width, image.Height));
|
new Rectangle(offset, 0, image.Width, image.Height));
|
||||||
offset += image.Width;
|
offset += image.Width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ namespace openalprnet_windemo
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
//clean up memory
|
//clean up memory
|
||||||
foreach (System.Drawing.Bitmap image in images)
|
foreach (var image in images)
|
||||||
{
|
{
|
||||||
image.Dispose();
|
image.Dispose();
|
||||||
}
|
}
|
||||||
@@ -126,6 +126,7 @@ namespace openalprnet_windemo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void processImageFile(string fileName)
|
private void processImageFile(string fileName)
|
||||||
{
|
{
|
||||||
resetControls();
|
resetControls();
|
||||||
@@ -137,7 +138,7 @@ namespace openalprnet_windemo
|
|||||||
|
|
||||||
var results = alpr.recognize(fileName);
|
var results = alpr.recognize(fileName);
|
||||||
|
|
||||||
List<Image> images = new List<Image>(results.Count());
|
var images = new List<Image>(results.Count());
|
||||||
var i = 1;
|
var i = 1;
|
||||||
foreach (var result in results)
|
foreach (var result in results)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user