public void ManipulateSeam(IImageProcessing imgProcessor,SeamDirection seamDirection)
        {
            int[,] energy = imgProcessor.Energy(new LaMImageData.EnergyCalGradient(), false);

            int[] dynamicSeamArray = Library.CreateDynamicSeam(energy,seamDirection);

            imgProcessor.DynamicRow(new PixelColor(), dynamicSeamArray,seamDirection);
        }
        public void ManipulateSeam(IImageProcessing imgProcessor, SeamDirection seamDirection)
        {
            int[,] energy = imgProcessor.Energy(new LaMImageData.EnergyCalGradient(), false);

            int seam = Library.FindStaticSeam(Library.TabSum(energy));

            imgProcessor.StaticRow(new PixelRemove(), seam);
        }
예제 #3
0
 /// <summary>
 /// Seam Manipulation
 /// </summary>
 /// <param name="seamManipulator">Seam Manipulator must</param>
 /// <param name="numberOfOper"></param>
 /// <returns></returns>
 public Bitmap SeamManipulation(ISeamManipulator seamManipulator, int numberOfOper,SeamDirection seamDirection)
 {
     _imgProcessor.Open();
     for (int i = 0; i < numberOfOper; i++)
     {
         seamManipulator.ManipulateSeam(_imgProcessor,seamDirection);
     }
     _imgProcessor.Close();
     return _imgProcessor.GetBmp();
 }
예제 #4
0
        private static int[] CutOneRow(int[,] energy, int row,SeamDirection seamDirection)
        {

            if (seamDirection == SeamDirection.Horizontal)
            {
                int[] tmpArray = new int[energy.GetLength(0)];
                for (int i = 0; i < energy.GetLength(0); i++)
                {
                    tmpArray[i] = energy[i, row];
                }
                return tmpArray;
            }
            else
            {
                int[] tmpArray = new int[energy.GetLength(1)];
                for (int i = 0; i < energy.GetLength(1); i++)
                {
                    tmpArray[i] = energy[row, i];
                }
                return tmpArray;
            }
        }
예제 #5
0
 private static int[] CutFirstRow(int[,] energy, SeamDirection seamDirection)
 {
     if (seamDirection == SeamDirection.Horizontal)
     {
         int[] tmpArray = new int[energy.GetLength(0)];
         for (int i = 0; i < energy.GetLength(0); i++)
         {
             for (int j = 0; j < energy.GetLength(1); j++)
             {
                 tmpArray[i] += energy[i, j];
             }
         }
         return tmpArray;
     }
     else
     {
         int[] tmpArray = new int[energy.GetLength(1)];
         for (int i = 0; i < energy.GetLength(1); i++)
         {
             for (int j = 0; j < energy.GetLength(0); j++)
             {
                 tmpArray[i] += energy[j, i];
             }
         }
         return tmpArray;
     }
 }
예제 #6
0
 private void comboBoxSeamDirection_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBoxSeamDirection.SelectedIndex == 0)
     {
         seamDirection = SeamDirection.Vertical;
     }
     else if (comboBoxSeamDirection.SelectedIndex == 1)
     {
         seamDirection = SeamDirection.Horizontal;
     }
     else
     {
         throw new ArgumentException("Seam Direction Init Failed");
     }
 }