예제 #1
0
        /// <summary>
        ///   Creates a new object that is a copy of the current instance.
        /// </summary>
        ///
        /// <returns>
        ///   A new object that is a copy of this instance.
        /// </returns>
        ///
        public object Clone()
        {
            var clone = new LocalBinaryPattern(blockSize, cellSize, normalize);

            clone.epsilon = epsilon;
            return(clone);
        }
예제 #2
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        ///
        protected override object Clone(ISet <PixelFormat> supportedFormats)
        {
            var clone = new LocalBinaryPattern(blockSize, cellSize, normalize);

            clone.epsilon          = epsilon;
            clone.SupportedFormats = supportedFormats;
            return(clone);
        }
예제 #3
0
        /// <summary>
        ///   Creates a new object that is a copy of the current instance.
        /// </summary>
        ///
        /// <returns>
        ///   A new object that is a copy of this instance.
        /// </returns>
        ///
        public object Clone()
        {
            var clone = new LocalBinaryPattern(blockSize, cellSize, normalize);

            clone.epsilon    = epsilon;
            clone.histograms = (int[, ][])histograms.Clone();
            clone.patterns   = (int[, ])patterns.Clone();
            return(clone);
        }
        public void Feature_extraction()
        {
            Image <Bgr, byte>  inputimage = new Image <Bgr, byte>(@"C:\Users\temp\Desktop\facebitmap.jpg");
            FileStream         fs         = new FileStream(@"C:\Users\temp\Desktop\Face_feature.txt", FileMode.Create, FileAccess.Write);
            StreamWriter       sw         = new StreamWriter(fs);
            LocalBinaryPattern lbp        = new Accord.Imaging.LocalBinaryPattern(3, 6, true);
            Image <Gray, byte> gray       = inputimage.Convert <Gray, byte>();

            // Image<Gray, byte> newgray = Resizegray(gray);
            //   newgray._EqualizeHist();

            //   Image<Gray, byte> mask = new Image<Gray, byte>(newgray.Width, newgray.Height);
            // Image<Gray, byte> dest = new Image<Gray, byte>(newgray.Width, newgray.Height);
            // CvInvoke.cvEllipse(mask, new Point(55, 50), new Size(52, 80), 0, 0, 360, new MCvScalar(256, 256, 256), -1, Emgu.CV.CvEnum.LINE_TYPE.CV_AA, 0);
            //  dest = newgray.And(newgray, mask);
            //  var newdest = dest.GetSubRect(new Rectangle(new Point(20, 23), new Size(80, 84)));
            //newdest.SmoothBilatral(0, 20, 2);

            // lbp.ProcessImage(newdest.Bitmap);


            for (int i = 0; i < 13; i++)
            {
                for (int j = 0; j < 14; j++)
                {
                    pixel1.Add(lbp.Histograms[i, j]);
                }
            }

            //   Matrix<float> pixeldata = new Matrix<float>(256, 256);

            for (int j = 0; j < 13 * 14; j++)
            {
                var pixe = pixel1[j];
                for (int i = 0; i < 256; i++)
                {
                    // lbpdata[0, i] += pixe[i];
                    Finaldata.Add(pixe[i]);
                }
            }
            //  CvInvoke.cvNormalize(pixeldata, pixeldata, 1, -1, NORM_TYPE.CV_L2, empty);

            string str = " ";

            sw.Write((4) + " ");

            for (int j = 0; j < 182 * 256; j++)
            {
                sw.Write((j + 1) + ":" + Finaldata[j] + str);
                sw.Write("");
            }

            sw.WriteLine();


            sw.Close();
            pixel1.Clear();
            Finaldata.Clear();

            /*
             * for (int o = 0; o <64*256; o++)
             * {
             *  SVMNode node = new SVMNode();
             *  node.Index = Convert.ToInt32(o);
             *  node.Value = Convert.ToDouble(Finaldata[o]);
             *  nodes.Add(node);
             * }
             * problem.Add(nodes.ToArray(), 1);
             * pixel1.Clear();
             * Finaldata.Clear();
             * return problem;
             */
        }