public SeamCarver(EnergyFuncType energyFuncType, bool hd, bool forwardEnergy, bool parallelization) { EnergyFuncType = energyFuncType; Hd = hd; ForwardEnergy = forwardEnergy; Parallelization = parallelization; }
public SeamCarverStandart(EnergyFuncType energyFuncType, bool hd, bool forwardEnergy, bool parallelization, double neighbourCountRatio, int blockSize) : base(energyFuncType, hd, forwardEnergy, parallelization) { NeighbourCountRatio = neighbourCountRatio; BlockSize = blockSize; }
private void btnProcess_Click(object sender, EventArgs e) { pbInput.Image = InputBitmap; EnergyFuncType energyFuncType = (EnergyFuncType)cmbEnergyFuncType.SelectedIndex; Bitmap resultBitmap = null; SeamCarvingMethod seamCarvingMethod = (SeamCarvingMethod)cmbSeamCarvingMethod.SelectedIndex; double widthRatio = double.Parse(tbWidthRatio.Text); double heightRatio = double.Parse(tbHeightRatio.Text); int newWidth = (int)Math.Round(widthRatio * InputBitmap.Width); int newHeight = (int)Math.Round(heightRatio * InputBitmap.Height); var stopwatch = new Stopwatch(); switch (seamCarvingMethod) { case SeamCarvingMethod.CAIR: Thread.Sleep(100); stopwatch.Start(); SeamCarverCair cairCarver = new SeamCarverCair(energyFuncType, cbHd.Checked, cbForwardEnergy.Checked, cbParallel.Checked, tbCairAppPath.Text); resultBitmap = cairCarver.Generate(InputBitmap, newWidth, newHeight); stopwatch.Stop(); break; default: case SeamCarvingMethod.Standart: stopwatch.Start(); SeamCarverStandart standrtCarver = new SeamCarverStandart(energyFuncType, cbHd.Checked, cbForwardEnergy.Checked, cbParallel.Checked, double.Parse(tbNeighbourCountRatio.Text), int.Parse(tbBlockSize.Text)); resultBitmap = standrtCarver.Generate(InputBitmap, newWidth, newHeight); stopwatch.Stop(); break; case SeamCarvingMethod.GPU: stopwatch.Start(); SeamCarverGPU gpuCarver = new SeamCarverGPU(energyFuncType, cbHd.Checked, cbForwardEnergy.Checked, cbParallel.Checked, int.Parse(tbBlockSize.Text)); resultBitmap = gpuCarver.Generate(InputBitmap, newWidth, newHeight); stopwatch.Stop(); break; } tbCalculationTime.Text = stopwatch.Elapsed.ToString(); pbOutput.Image = resultBitmap; }
public SeamCarverGPU(EnergyFuncType energyFuncType, bool hd, bool forwardEnergy, bool parallelization, int blockSize) : base(energyFuncType, hd, forwardEnergy, parallelization, 0, blockSize) { }
public SeamCarverCair(EnergyFuncType energyFuncType, bool hd, bool forwardEnergy, bool parallelization, string cairAppFileName) : base(energyFuncType, hd, forwardEnergy, parallelization) { CairAppFileName = cairAppFileName; }