Пример #1
0
        private void btnEncodeOriginalImage_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(inputFilePathEncoder))
                {
                    throw new NullReferenceException();
                }

                userKMaxReconstructionError = (int)numericUpDownKValue.Value;

                switch (comboBoxPredictorSelection.SelectedIndex)
                {
                case 1: userPredictorSelection = 1; break;

                case 2: userPredictorSelection = 2; break;

                case 3: userPredictorSelection = 3; break;

                case 4: userPredictorSelection = 4; break;

                case 5: userPredictorSelection = 5; break;

                case 6: userPredictorSelection = 6; break;

                case 7: userPredictorSelection = 7; break;

                case 8: userPredictorSelection = 8; break;

                default: userPredictorSelection = 0; break;
                }

                nlEngine = new NearLosslessEngine(bmpObject.GetBmpData());
                nlEngine.CompressImage(userPredictorSelection, userKMaxReconstructionError);
                MessageBox.Show("Image was encoded succesfully!");
                isFileEncoded = true;
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Warning: You forgot to load Original Image!");
            }
        }
Пример #2
0
        private void btnVerify_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(inputFilePathDecoder))
                {
                    throw new NullReferenceException();
                }
                if (auxOriginalImage == null || isFileDecoded == false)
                {
                    throw new NullReferenceException();
                }

                nlEngine = new NearLosslessEngine(bmpObject.GetBmpDataEncoded());
                nlEngine.DecompressImage(decodingP, decodingK, auxOriginalImage);
                textBoxMinErrorValue.Text = nlEngine.minValueError.ToString();
                textBoxMaxErrorValue.Text = nlEngine.maxValueError.ToString();
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Warning: You forgot to load original image/ decode the same image!");
            }
        }
Пример #3
0
        private void btnDecodeImage_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(inputFilePathDecoder))
                {
                    throw new NullReferenceException();
                }

                nlEngine = new NearLosslessEngine(bmpObject.GetBmpDataEncoded());

                nlEngine.DecompressImage(decodingP, decodingK, auxOriginalImage);

                pictureBoxDecodedImage.Image = Helpers.BuildBitmapFromMatrix(nlEngine.GetDecodedImageMatrix());

                MessageBox.Show("Image was decoded succesfully!");
                label15.Text  = "Decoded Image";
                isFileDecoded = true;
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Warning: You forgot to load Decoded Image!");
            }
        }