Add code for image processing.
This commit is contained in:
92
Program.cs
92
Program.cs
@@ -610,6 +610,74 @@ namespace MarketData
|
|||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void GenerateImageData()
|
||||||
|
{
|
||||||
|
GenerateImageData(@"C:\DeepLearningImageData\0",@"c:\3\0");
|
||||||
|
GenerateImageData(@"C:\DeepLearningImageData\1",@"c:\3\1");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void GenerateImageData(String inputFolder,String destinationFolder)
|
||||||
|
{
|
||||||
|
// String destinationFolder = @"c:\3\1";
|
||||||
|
ImageHelper imageHelper = new ImageHelper();
|
||||||
|
String[] files = Directory.GetFiles(inputFolder, "*.jpg");
|
||||||
|
foreach (String file in files)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String fileName = Path.GetFileName(file);
|
||||||
|
String pathFileName = destinationFolder + @"\" + fileName;
|
||||||
|
String pathFileNameL = destinationFolder + @"\" + Utility.BetweenString(fileName,null,".")+"L.jpg";
|
||||||
|
String pathFileNameR = destinationFolder + @"\" + Utility.BetweenString(fileName,null,".")+"R.jpg";
|
||||||
|
String pathFileNameU = destinationFolder + @"\" + Utility.BetweenString(fileName,null,".")+"U.jpg";
|
||||||
|
String pathFileNameB1 = destinationFolder + @"\" + Utility.BetweenString(fileName,null,".")+"B1.jpg";
|
||||||
|
String pathFileNameB2 = destinationFolder + @"\" + Utility.BetweenString(fileName,null,".")+"B2.jpg";
|
||||||
|
String pathFileNameB3 = destinationFolder + @"\" + Utility.BetweenString(fileName,null,".")+"B3.jpg";
|
||||||
|
String pathFileNameB4 = destinationFolder + @"\" + Utility.BetweenString(fileName,null,".")+"B4.jpg";
|
||||||
|
|
||||||
|
Console.WriteLine(String.Format("Reading {0}", file));
|
||||||
|
imageHelper.LoadImage(file);
|
||||||
|
imageHelper.Resize(128, 128);
|
||||||
|
|
||||||
|
ImageHelper bmpLeft=new ImageHelper(imageHelper);
|
||||||
|
ImageHelper bmpRight=new ImageHelper(imageHelper);
|
||||||
|
ImageHelper bmpUDown=null;
|
||||||
|
bmpLeft.RotateLeft();
|
||||||
|
bmpRight.RotateRight();
|
||||||
|
bmpUDown=new ImageHelper(bmpRight);
|
||||||
|
bmpUDown.RotateRight();
|
||||||
|
|
||||||
|
bmpLeft.ToGrayScale();
|
||||||
|
bmpRight.ToGrayScale();
|
||||||
|
bmpUDown.ToGrayScale();
|
||||||
|
imageHelper.ToGrayScale();
|
||||||
|
|
||||||
|
imageHelper.Save(pathFileName);
|
||||||
|
bmpLeft.Save(pathFileNameL);
|
||||||
|
bmpRight.Save(pathFileNameR);
|
||||||
|
bmpUDown.Save(pathFileNameU);
|
||||||
|
|
||||||
|
ImageHelper bmpBlur1=new ImageHelper(imageHelper);
|
||||||
|
ImageHelper bmpBlur2=new ImageHelper(bmpLeft);
|
||||||
|
ImageHelper bmpBlur3=new ImageHelper(bmpRight);
|
||||||
|
ImageHelper bmpBlur4=new ImageHelper(bmpUDown);
|
||||||
|
bmpBlur1.Blur(3);
|
||||||
|
bmpBlur2.Blur(3);
|
||||||
|
bmpBlur3.Blur(3);
|
||||||
|
bmpBlur4.Blur(3);
|
||||||
|
bmpBlur1.Save(pathFileNameB1);
|
||||||
|
bmpBlur2.Save(pathFileNameB2);
|
||||||
|
bmpBlur3.Save(pathFileNameB3);
|
||||||
|
bmpBlur4.Save(pathFileNameB4);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Console.WriteLine(exception.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// *******************************************************************************
|
// *******************************************************************************
|
||||||
// **********************************************************************************************************
|
// **********************************************************************************************************
|
||||||
static int Main(string[] args)
|
static int Main(string[] args)
|
||||||
@@ -622,29 +690,7 @@ namespace MarketData
|
|||||||
Trace.Listeners.Add(new TextWriterTraceListener(strLogFile));
|
Trace.Listeners.Add(new TextWriterTraceListener(strLogFile));
|
||||||
DateTime currentDate=DateTime.Now;
|
DateTime currentDate=DateTime.Now;
|
||||||
|
|
||||||
|
// GenerateImageData();
|
||||||
//String destinationFolder = @"c:\3\1";
|
|
||||||
//ImageHelper imageHelper = new ImageHelper();
|
|
||||||
//String[] files = Directory.GetFiles(@"\\IO\Media\Thumbnails\1\","*.jpg");
|
|
||||||
//foreach(String file in files)
|
|
||||||
//{
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// String fileName = Path.GetFileName(file);
|
|
||||||
// String pathFileName = destinationFolder +@"\" + fileName;
|
|
||||||
// Console.WriteLine(String.Format("Reading {0}",file));
|
|
||||||
// imageHelper.LoadImage(file);
|
|
||||||
// imageHelper.Resize(128,128);
|
|
||||||
// Console.WriteLine(String.Format("Writing {0}",pathFileName));
|
|
||||||
// imageHelper.SaveGrayScaleJPG(pathFileName);
|
|
||||||
// }
|
|
||||||
// catch(Exception exception)
|
|
||||||
// {
|
|
||||||
// Console.WriteLine(exception.ToString());
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DateTime maxHolidayDate =HolidayDA.GetMaxHolidayDate();
|
DateTime maxHolidayDate =HolidayDA.GetMaxHolidayDate();
|
||||||
if(currentDate>maxHolidayDate)
|
if(currentDate>maxHolidayDate)
|
||||||
|
|||||||
Reference in New Issue
Block a user