Exemplo n.º 1
0
        // our constructor for creating using 256 RGB values.
        public static IntegralImage FromImageGrey(Bitmap image)
        {
            IntegralImage pic = new IntegralImage(image.Width, image.Height);

            float rowsum = 0;
            BitmapData dataIn = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);

            unsafe
            {
                byte* pIn = (byte*)(dataIn.Scan0.ToPointer());
                for (int y = 0; y < dataIn.Height; y++)
                {
                    rowsum = 0;
                    for (int x = 0; x < dataIn.Width; x++)
                    {
                        int cb = (byte)(pIn[0]);
                        int cg = (byte)(pIn[1]);
                        int cr = (byte)(pIn[2]);

                        rowsum += (cR * cr + cG * cg + cB * cb) / 255f;
                        // integral image is rowsum + value above
                        if (y == 0)
                            pic[0, x] = rowsum;
                        else
                            pic[y, x] = rowsum + pic[y - 1, x];

                        pIn += 3;
                    }
                    pIn += dataIn.Stride - dataIn.Width * 3;
                }
            }
            image.UnlockBits(dataIn);

            return pic;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor with parameters
 /// </summary>
 /// <param name="thresh"></param>
 /// <param name="octaves"></param>
 /// <param name="init_sample"></param>
 /// <param name="img"></param>
 public FastHessian(float thresh, int octaves, int init_sample, IntegralImage img)
 {
     this.thresh = thresh;
       this.octaves = octaves;
       this.init_sample = init_sample;
       this.img = img;
 }
Exemplo n.º 3
0
        // Build descriptors for each interest point in the supplied list
        public void DescribeInterestPoints(List<IPoint> ipts, bool upright, bool extended, IntegralImage img)
        {
            if (ipts.Count == 0)
                return;

            this.img = img;

            foreach (IPoint ip in ipts)
            {
                // determine descriptor size
                if (extended)
                    ip.descriptorLength = 128;
                else
                    ip.descriptorLength = 64;

                // if we want rotation invariance get the orientation
                if (!upright)
                    GetOrientation(ip);

                // Extract SURF descriptor
                GetDescriptor(ip, upright, extended);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Static one-call do it all method
 /// </summary>
 /// <param name="thresh"></param>
 /// <param name="octaves"></param>
 /// <param name="init_sample"></param>
 /// <param name="img"></param>
 /// <returns></returns>
 public static List<IPoint> getIpoints(float thresh, int octaves, int init_sample, IntegralImage img)
 {
     FastHessian fh = new FastHessian(thresh, octaves, init_sample, img);
       return fh.getIpoints();
 }
Exemplo n.º 5
0
 // Static one-call do it all function
 public static void DecribeInterestPoints(List<IPoint> ipts, bool upright, bool extended, IntegralImage img)
 {
     SurfDescriptor des = new SurfDescriptor();
     des.DescribeInterestPoints(ipts, upright, extended, img);
 }