コード例 #1
0
        private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            watch.Stop();
            string timeTaken = String.Format("Width: {0} Height: {1} Time taken: {2} ms", myImage.Width, myImage.Height, watch.ElapsedMilliseconds.ToString());

            Console.WriteLine(timeTaken);
            labelTimeTaken.Content = timeTaken;

            if (e.Cancelled)
            {
            }
            else if (e.Error != null)
            {
                Console.WriteLine(e.Error);
            }
            else
            {
                // Draw histogram and image for each channel
                DrawOnScreen(myImage.NumCh, channelImages);

                // Draw image on screen
                imageOriginal.Source = Utils.getSource(myImage.GetBitmap());

                // Draw graphs
                histogramR.PlotBars(histograms[2]);
                histogramG.PlotBars(histograms[1]);
                histogramB.PlotBars(histograms[0]);

                comulativeHistogramR.PlotY(comulativeFrequencies[2]);
                comulativeHistogramG.PlotY(comulativeFrequencies[1]);
                comulativeHistogramB.PlotY(comulativeFrequencies[0]);
            }
        }
コード例 #2
0
        /// <summary>
        /// Draw channel image
        /// </summary>
        /// <param name="bitplane">bitplane of current image</param>
        /// <param name="ch">current channel</param>
        /// <param name="numCh">total number of channels</param>
        /// <returns>Image</returns>
        public static Bitmap getChannelImage(MyBitplane bitplane, int ch, int numCh)
        {
            MyImage myImage = new MyImage(bitplane.Width, bitplane.Height, numCh);

            myImage.Bitplane[ch] = bitplane;

            return(myImage.GetBitmap());
        }