Start New Discussion within our Software Development Community

Hello everyone!
I am trying to divide image into blocks of 8x8 pixels and applying DCT Transform in each blocks.
But I don't know how to divide the image. Thanks for helping me.

namespace DCTTransform
{
    public partial class Form1 : Form
    {
        Image<Bgr, Byte> img;
        Image<Ycc, Byte> imgYcc;
        Bitmap bmp;

        public Form1()
        {
            InitializeComponent();
        }

        private void btBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog od = new OpenFileDialog();
            if (od.ShowDialog() == DialogResult.OK)
            {
                img = new Image<Bgr, byte>(od.FileName);
                pcCitra.Image = img.ToBitmap();
            }
        }


        private void btTransform_Click(object sender, EventArgs e)
        {

            int i, j;
            double[,] subBlok;

            int width = pcCitra.Image.Width;
            int height = pcCitra.Image.Height;
            int baris = 0;
            int kolom = 0;



            for (i = 0; i < width-1; i++)
            {
                for (j = 0; j < height - 1; j++)
                {
                    if (baris == 7)
                    {
                        baris = 0;
                        kolom += 1;
                    }

                    subBlok[baris, kolom] = Math.Ceiling((width * height) / (8 * 8));

                }

            }

        }
    }`
}
This article has been dead for over six months. Start a new discussion instead.