Ejemplo n.º 1
0
        public static unsafe dynamic to_numpy(this CameraImage img)
        {
            var     ptr   = (UInt64)img.raw;
            var     shape = img.shape();
            var     dtype = img.dtype();
            dynamic ret   = null;

            Py.Run(() => {
                ret = Py.lib.pointer_to_ndarray(ptr, shape, dtype);
            });
            return(ret);
        }
Ejemplo n.º 2
0
        private void Track_Click(object sender, RoutedEventArgs e)
        {
            CameraImage img = null;
            var         res = 0.430549162042795D;

            List <double> center = null;

            Py.Run(() => {
//                dynamic ret = Py.lib.detect_body(img, Pynder.PyObjects.Sun, res);
                if (Py.lib.detect_mock() is PyObject ret && ret.ToCLI() is List <object> retList && retList.All())
                {
                }
            });
        }
Ejemplo n.º 3
0
        public CameraImage Copy()
        {
            var ret = new CameraImage(Width, Height, Channels, Depth);

            rwlock.EnterReadLock();

            ret.rwlock.EnterWriteLock();
            for (var i = 0; i < Size; ++i)
            {
                ((byte *)ret.raw)[i] = ((byte *)raw)[i];
            }
            ret.rwlock.ExitWriteLock();

            ret._bitmapCache = _bitmapCache;
            rwlock.ExitReadLock();

            return(ret);
        }
Ejemplo n.º 4
0
 public static string dtype(this CameraImage img)
 {
     return(img.Depth == BitDepth.depth8  ? "uint8" :
            img.Depth == BitDepth.depth16 ? "uint16" :
            img.Depth == BitDepth.depth32 ? "uint32" : null);
 }
Ejemplo n.º 5
0
 public static int[] shape(this CameraImage img)
 {
     return(new [] { img.Height, img.Width, img.Channels });
 }