Ejemplo n.º 1
0
 public void add(node item)
 {
     elements.Add(item);
     this.HeapifyUp(elements.Count - 1);
 }
 public void set_pointers(node first, node second)
 {
     this.left  = second;
     this.right = first;
 }
 public node(int val)
 {
     value = val;
     left  = right = null;
 }
 public node()
 {
     left = right = null;
 }
Ejemplo n.º 5
0
//########################################################################################################################################################
        public static void decomprassion1(ref RGBPixel[,] ImageMatrix, node r_red, node r_green, node r_blue)
        {
            char         ch;
            StreamReader reader;
            FileInfo     ff     = new FileInfo("comprass.txt");
            int          gg     = (int)ff.Length;
            BitArray     b2     = new BitArray(gg * 8);
            int          index1 = 0;
            int          index  = -1;

            reader = new StreamReader("comprass.txt");
            while (!reader.EndOfStream)
            {
                ch = (char)reader.Read();
                byte     bn = (byte)ch;
                BitArray bc = new BitArray(new byte[] { bn });
                for (int ii = 0; ii < 8; ii++)
                {
                    b2[index1] = bc[ii];
                    index1++;
                }
            }
            reader.Close();
            for (int i = 0; i < ImageMatrix.GetLength(0); i++)
            {
                for (int f = 0; f < ImageMatrix.GetLength(1); f++)
                {
                    ImageMatrix[i, f].red   = decomprss1(r_red, b2, ref index);
                    ImageMatrix[i, f].green = decomprss1(r_green, b2, ref index);
                    ImageMatrix[i, f].blue  = decomprss1(r_blue, b2, ref index);
                }
            }
        }
Ejemplo n.º 6
0
//########################################################################################################################################################
        public static void tree(ref RGBPixel[,] ImageMatrix, ref node root_red, ref node root_green, ref node root_blue)
        {
            List <node> fred   = new List <node>();
            List <node> fgreen = new List <node>();
            List <node> fblue  = new List <node>();

            ImageOperations.make_freq(ImageMatrix, ref fred, ref fgreen, ref fblue);
            using (StreamWriter writetext = new StreamWriter("red.txt"))
            {
                for (int i = 0; i < fred.Count; i++)
                {
                    writetext.WriteLine(fred[i].value + "  " + fred[i].freq);
                }
            }
            using (StreamWriter writetext = new StreamWriter("green.txt"))
            {
                for (int i = 0; i < fgreen.Count; i++)
                {
                    writetext.WriteLine(fgreen[i].value + "  " + fgreen[i].freq);
                }
            }
            using (StreamWriter writetext = new StreamWriter("blue.txt"))
            {
                for (int i = 0; i < fblue.Count; i++)
                {
                    writetext.WriteLine(fblue[i].value + "  " + fblue[i].freq);
                }
            }
            root_red   = ImageOperations.tree_color(fred);
            root_green = ImageOperations.tree_color(fgreen);
            root_blue  = ImageOperations.tree_color(fblue);
        }