/// <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); }
internal static HandleRef getCPtr(PixelRgb obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
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); }
public PixelRgb safePixel(uint x, uint y) { PixelRgb ret = new PixelRgb(yarpPINVOKE.ImageRgb_safePixel__SWIG_0(swigCPtr, x, y), false); return(ret); }
public PixelRgb access(uint x, uint y) { PixelRgb ret = new PixelRgb(yarpPINVOKE.ImageRgb_access__SWIG_0(swigCPtr, x, y), false); return(ret); }
public PixelRgb safePixel(int x, int y) { PixelRgb ret = new PixelRgb(yarpPINVOKE.ImageRgb_safePixel__SWIG_0(swigCPtr, x, y), false); return ret; }
public PixelRgb pixel(int x, int y) { PixelRgb ret = new PixelRgb(yarpPINVOKE.ImageRgb_pixel(swigCPtr, x, y), false); return ret; }