public void SetUp() { _inputPath = ExecutionDirInfoHelper.GetInputDirPath(); var imgPath = _inputPath + @"\testIndex.bmp"; _img = (Bitmap)Image.FromFile(imgPath); }
public void TestModelCreationForDinosaur() { var imageFolder = string.Format(@"{0}\{1}", ExecutionDirInfoHelper.GetInputDirPath(), "dinosaur"); var outputFolder = ExecutionDirInfoHelper.CreateUniqueOutputPath(); var contract = new CreateModelContract { VariationIn3DCoordinates = 5.0f, //todo: this wont work AllImgProcessedEventArgs1 uses an old class which will fail deserialization ClickInputs = MainProcessor.GetClickInputsFromFile(imageFolder + @"\AllImgProcessedEventArgs.xml"), InvalidColor = System.Drawing.Color.FromArgb(1, 200, 200, 200), ImageFolder = imageFolder, BackgroundStrippingParams = new BackgroundStrippingParams { ScreenBasedParams = new ScreenBasedParams { MaxDiffPercent = 99, MinColorOffset = 25, ScreenColorTypes = ScreenColorTypes.BlueScreen } }, SmoothingIterationCount = 2, LogFilePath = outputFolder + @"\Log.txt", PtDensity = 200 }; var modelMeshAndTexture = MainProcessor.CreateDefaultModel(contract); XamlWriter.SaveMeshGeometryModel(outputFolder + @"\model.xaml", modelMeshAndTexture.MeshGeometry, modelMeshAndTexture.TextureBitmap); }
public void TestColorVariationCalculatorForUnStrippedMarioImage() { var filePath = String.Format(@"{0}\mario\IMG_0944.JPG", ExecutionDirInfoHelper.GetInputDirPath());; var image = (Bitmap)Image.FromFile(filePath); const string outputFile = @"\TestColorVariationCalculatorForUnStrippedMarioImage.png"; const int targetYVal = 340; PrintVariations(image, targetYVal, outputFile); }
public void TestClickPositionCalculatorWithMarioImage() { var filePath = String.Format(@"{0}\Mario\IMG_0944.JPG", ExecutionDirInfoHelper.GetInputDirPath()); const int minPixelsForBaseDisc = 25; const string outputFileName = @"\TestClickPositionCalculatorWithMarioImage.png"; RunTest(minPixelsForBaseDisc, filePath, outputFileName); }
public void TestClickPositionCalculatorWithPerfectVerticalDisc() { var filePath = String.Format(@"{0}\TestImage1.png", ExecutionDirInfoHelper.GetInputDirPath()); const int minPixelsForBaseDisc = 100; const string outputFileName = @"\TestClickPositionCalculatorWithPerfectVerticalDisc.png"; RunTest(minPixelsForBaseDisc, filePath, outputFileName); }
public void TestColorVariationFromASinglePtListForMarioImage() { var filePath = String.Format(@"{0}\mario\IMG_0944.JPG", ExecutionDirInfoHelper.GetInputDirPath());; var image = (Bitmap)Image.FromFile(filePath); const string outputFile = @"\TestColorVariationFromASinglePtListForMarioImage.png"; const int targetYVal = 340; var variations = ColorVariationCalculator.GetColorVariationFromASinglePtList(image, 0, image.Width - 1, image.Height - targetYVal, 0); PrintProvidedVariations(image, targetYVal, variations, outputFile); }
public void TestColorVariationPercentBasedStripperWithMyPhotoImage() { const string inputFileName = @"\MyPhoto.jpg"; const string outputFileName = @"\TestColorVariationPercentBasedStripperWithMyPhotoImage.png"; var sourceImagePath = ExecutionDirInfoHelper.GetInputDirPath() + inputFileName; var bitmap = (Bitmap)Image.FromFile(sourceImagePath); var backgroundColor = new SerializableColor(200, 200, 200); var @params = new BackgroundStrippingParams { BackgroundColor = backgroundColor, ColorVariationBasedParams = new ColorVariationBasedParams { VariationPercent = 10, CompareColor = GetColor(bitmap.GetPixel(0, 0)) } }; BackgroundStripper.StripBackground(bitmap, @params); var @params1 = new BackgroundStrippingParams { BackgroundColor = backgroundColor, ColorVariationBasedParams = new ColorVariationBasedParams { VariationPercent = 5, CompareColor = GetColor(bitmap.GetPixel(626, 1802)) } }; BackgroundStripper.StripBackground(bitmap, @params1); var @params2 = new BackgroundStrippingParams { BackgroundColor = backgroundColor, ColorVariationBasedParams = new ColorVariationBasedParams { VariationPercent = 5, CompareColor = GetColor(bitmap.GetPixel(549, 1750)) } }; BackgroundStripper.StripBackground(bitmap, @params2); var targetPath = ExecutionDirInfoHelper.GetOutputDirPath() + outputFileName; bitmap.Save(targetPath); }
public void TestRotationAlongTheXAxis() { var inputPts = new MdlFilePolygonDataReader(ExecutionDirInfoHelper.GetInputDirPath() + @"\1.mdl").Points; var outputDirPath = ExecutionDirInfoHelper.GetOutputDirPath() + @"\TestRotationAlongTheXAxis"; if (!Directory.Exists(outputDirPath)) { Directory.CreateDirectory(outputDirPath); } XamlWriter.WritePolygonsToXamlFile("", string.Format(@"{0}\Input.xaml", outputDirPath), inputPts, false); for (var angleInRadian = 0.0; angleInRadian <= Math.PI * 2; angleInRadian += Math.PI * 2.0 / 18.0)//every 20 degrees { var outputPts = RotateAlongXYOrZAxis.GetRotatedPtList(Axis.X, angleInRadian, inputPts.ToArray()); XamlWriter.WritePolygonsToXamlFile("", string.Format(@"{0}\Output_X_{1}.xaml", outputDirPath, CommonFunctions.RadianToDegrees(angleInRadian, 0)), outputPts, false); } }
private static void RunTest(string inputFileName, string outputFileName, int variationPercent, Point imgLocationOfBaseColor) { var sourceImagePath = ExecutionDirInfoHelper.GetInputDirPath() + inputFileName; var bitmap = (Bitmap)Image.FromFile(sourceImagePath); var backgroundColor = new SerializableColor(200, 200, 200); var @params = new BackgroundStrippingParams { BackgroundColor = backgroundColor, ColorVariationBasedParams = new ColorVariationBasedParams { VariationPercent = variationPercent, CompareColor = GetColor(bitmap.GetPixel(imgLocationOfBaseColor.X, imgLocationOfBaseColor.Y)) } }; BackgroundStripper.StripBackground(bitmap, @params); var targetPath = ExecutionDirInfoHelper.GetOutputDirPath() + outputFileName; bitmap.Save(targetPath); }
public void TestWithExtraWidthThatMakesLeftNegative() { var imageFolder = string.Format(@"{0}\{1}", ExecutionDirInfoHelper.GetInputDirPath(), "testcropping_disc_very_left_of_image"); var clickInputs = MainProcessor.GetClickInputsFromFile(imageFolder + @"\ClickInputs.xml"); var imagePath = string.Format(@"{0}\{1}", imageFolder, clickInputs.ImageClickInputDetailsList[0].ImageName); _image = (Bitmap)Image.FromFile(imagePath); var imageAlterationParams = new ImageAlterationParams { MinImageHeightRatio = 0.7, PercentExtraWidth = 10, InvalidColor = _bkColor, BottomPaddingPercent = 0 }; var croppedImg = ImageCropper.GetCroppedImage(clickInputs.ImageClickInputDetailsList[0], _image, imageAlterationParams); var outputPath = string.Format(@"{0}\cropped_with_extra_beyond_left.jpg", _outputFolder); croppedImg.Save(outputPath); }
public void SetUp() { _sourceDirPath = ExecutionDirInfoHelper.GetInputDirPath() + Comparisonwithimgwithoutmodel; _outputDirPath = ExecutionDirInfoHelper.GetOutputDirPath(); }
public void SetUp() { _inputFilePath = ExecutionDirInfoHelper.GetInputDirPath(); _outputFilePath = ExecutionDirInfoHelper.CreateUniqueOutputPath(); }
public void SetUp() { _sourceDirPath = ExecutionDirInfoHelper.GetInputDirPath(); _outputDirPath = ExecutionDirInfoHelper.GetOutputDirPath(); }
internal static Bitmap GetStrippedTestImageForPerfectlyVerticalBase(Color backgroundColor) { var filePath = String.Format(@"{0}\TestImage1.png", ExecutionDirInfoHelper.GetInputDirPath()); return(GetStrippedImage(filePath)); }
internal static Bitmap GetStrippedTestImage() { var filePath = String.Format(@"{0}\TestImage.png", ExecutionDirInfoHelper.GetInputDirPath()); return(GetStrippedImage(filePath)); }
internal static Bitmap GetStrippedFirstMarioImage(Color backgroundColor) { var filePath = String.Format(@"{0}\mario\IMG_0944.JPG", ExecutionDirInfoHelper.GetInputDirPath()); return(GetStrippedImage(filePath)); }