Ejemplo n.º 1
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                var scale = (float)numericUpDownHistogramScale.Value;

                switch (comboBoxHistogram.SelectedIndex)
                {
                case 0: Helpers.DrawHistogram(pictureBoxHistogram, Helpers.CreateHistogram(nlEngine.GetOriginalImageMatrix()), scale);  break;

                case 1: Helpers.DrawHistogram(pictureBoxHistogram, Helpers.CreateHistogram(nlEngine.GetErrorPredictedMatrix()), scale); break;

                case 2: Helpers.DrawHistogram(pictureBoxHistogram, Helpers.CreateHistogram(nlEngine.GetErrorPredictedQuantizedMatrix()), scale); break;

                case 3: Helpers.DrawHistogram(pictureBoxHistogram, Helpers.CreateHistogram(nlEngine.GetDecodedImageMatrix()), scale);   break;

                default:
                    if (bmpObject.GetBmpData() != null && bmpObject.GetBmpDataEncoded() == null)
                    {
                        Helpers.DrawHistogram(pictureBoxHistogram, Helpers.CreateHistogram(bmpObject.GetBmpData()), scale);
                    }
                    if (bmpObject.GetBmpDataEncoded() != null && bmpObject.GetBmpData() == null)
                    {
                        Helpers.DrawHistogram(pictureBoxHistogram, Helpers.CreateHistogram(bmpObject.GetBmpDataEncoded()), scale);
                    }
                    break;
                }
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Error, you forgot to load or to encode the image!");
            }
        }
Ejemplo n.º 2
0
        //-----------------------------------------------------------------------------------------------------------------------
        //  Form Designer Methods -- DECODER
        //-----------------------------------------------------------------------------------------------------------------------

        private void btnLoadDecoded_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "NearLosslesPredictor (*nlp)|*.nlp";

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                label15.Text         = "Encoded Image";
                inputFilePathDecoder = ofd.FileName;
                bmpObject            = Helpers.ReadEncodedBmpFormat(inputFilePathDecoder, ref decodingK, ref decodingP);

                // encoded  data/ header/ k/ p/ sm/  -> global

                Helpers.DrawHistogram(pictureBoxHistogram, Helpers.CreateHistogram(bmpObject.GetBmpDataEncoded()), (float)numericUpDownHistogramScale.Value);
            }
        }