Exemplo n.º 1
0
        /// <summary>
        /// Self explicit
        /// </summary>
        /// <param name="img"></param>
        /// <returns></returns>
        protected float[] Image2Vector(ImageRgb img)
        {
            double t0 = Time.now();

            ImageRgb img2 = new ImageRgb();

            img2.copy(img, w, h);

            float[] v = new float[size];

            for (int i = 0; i < w; i++)
            {
                for (int j = 0; j < h; j++)
                {
                    PixelRgb px = img2.pixel(i, j);
                    v[j * w + i]     = px.r / 255.0f; //Scale in [0,1]
                    v[j * w + i + 1] = px.g / 255.0f; //Scale in [0,1]
                    v[j * w + i + 2] = px.b / 255.0f; //Scale in [0,1]
                }
            }
            double t1 = Time.now();

            //Console.WriteLine("Image2Vector : " + (t1 - t0).ToString());

            return(v);
        }
Exemplo n.º 2
0
 internal static HandleRef getCPtr(PixelRgb obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Exemplo n.º 3
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PixelRgb obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Exemplo n.º 4
0
    public PixelRgb safePixel(uint x, uint y)
    {
        PixelRgb ret = new PixelRgb(yarpPINVOKE.ImageRgb_safePixel__SWIG_0(swigCPtr, x, y), false);

        return(ret);
    }
Exemplo n.º 5
0
    public PixelRgb access(uint x, uint y)
    {
        PixelRgb ret = new PixelRgb(yarpPINVOKE.ImageRgb_access__SWIG_0(swigCPtr, x, y), false);

        return(ret);
    }
Exemplo n.º 6
0
 public PixelRgb safePixel(int x, int y)
 {
     PixelRgb ret = new PixelRgb(yarpPINVOKE.ImageRgb_safePixel__SWIG_0(swigCPtr, x, y), false);
     return ret;
 }
Exemplo n.º 7
0
 public PixelRgb pixel(int x, int y)
 {
     PixelRgb ret = new PixelRgb(yarpPINVOKE.ImageRgb_pixel(swigCPtr, x, y), false);
     return ret;
 }