Enhancements.

This commit is contained in:
2024-08-01 17:25:17 -04:00
parent c4577b4374
commit 7f48834f23
2 changed files with 65 additions and 6 deletions

View File

@@ -27,6 +27,11 @@ namespace MarketData.CNNProcessing
}
public void Dispose()
{
DisposeAll();
}
private void DisposeAll()
{
if(null!=bitmap)
{
@@ -55,20 +60,38 @@ namespace MarketData.CNNProcessing
return copy;
}
public bool LoadImage(Stream stream)
{
try
{
DisposeAll();
Image image=Image.FromStream(stream);
bitmap = new Bitmap(image);
height = bitmap.Height;
width = bitmap.Width;
return true;
}
catch(Exception exception)
{
MDTrace.WriteLine(LogLevel.DEBUG,exception.ToString());
return false;
}
}
public bool LoadImage(string pathFileName)
{
Stream bitmapStream = null;
try
{
bitmapStream = File.Open(pathFileName,FileMode.Open);
Image image = Image.FromStream(bitmapStream);
bitmap=new Bitmap(image);
DisposeAll();
bitmap = new Bitmap(pathFileName);
width=bitmap.Width;
height=bitmap.Height;
return true;
}
catch(Exception)
catch(Exception exception)
{
MDTrace.WriteLine(LogLevel.DEBUG,exception.ToString());
return false;
}
finally
@@ -125,8 +148,9 @@ namespace MarketData.CNNProcessing
graphics.Dispose();
return true;
}
catch(Exception)
catch(Exception exception)
{
MDTrace.WriteLine(LogLevel.DEBUG,exception.ToString());
return false;
}
finally