private void ButtonRunImage_Click(object sender, EventArgs e) { if (pictureBoxUploadedImage == null || pictureBoxUploadedImage.Image == null) { MessageBox.Show("Upload an image first"); return; } string binaryUserInput = BitUtils.ImageToBinaryString(pictureBoxUploadedImage.Image); // Užkodavimas, siuntimas kanalu ir dekodavimas --------------------------------- string encoderOutput = _convolutionalEncoder.Encode(binaryUserInput); _simpleChannel.SetNoiseLevel((double)numericUpDownNoiseLevel.Value); int headerSize = binaryUserInput.Length - Image.GetPixelFormatSize(pictureBoxUploadedImage.Image.PixelFormat) * (pictureBoxUploadedImage.Image.Width * pictureBoxUploadedImage.Image.Height); // Pagal sąsūkos kodą užkodavus pranešimą jo ilgis yra 2k + 12, todėl atitinkamai headerio dydis pailgėja taip pat. string channelOutput = _simpleChannel.AddNoise(encoderOutput, (headerSize + 1) * 2 + 12); string decoderOutput = _convolutionalDecoder.Decode(channelOutput); pictureBoxDecoderOutput.Image = BitUtils.BinaryStringToImage(decoderOutput); // Tik siuntimas kanalu --------------------------------------------------------- channelOutput = _simpleChannel.AddNoise(binaryUserInput, headerSize + 1); pictureBoxChannelOutput.Image = BitUtils.BinaryStringToImage(channelOutput); }