Esempio n. 1
0
        public SonyImage StartCapture(double duration, int personality, short readoutMode)
        {
            ImageInfo info = new ImageInfo();

            if (m_lastImage != null)
            {
                m_lastImage.Cleanup();
                m_lastImage = null;
            }

            // 32-bit apps tend to run close to the line of memory
            // The auto garbage collection tends to fail when we're talking the large files
            // a 60MP camera can deliver, and an attempt to allocate more than is available doesn't
            // seem to trigger a collection - so we'll just do it here.
            // TODO: Make this conditional on 32-bit execution
            if (!Environment.Is64BitProcess)
            {
                GC.Collect();
            }

            info.Status       = STATUS_EXPOSING;
            info.ImageMode    = (uint)m_outputMode;
            info.ExposureTime = duration;

            if (Mode.Preview)
            {
                info.ImageMode = IMAGEMODE_RGB;
                GetPreviewImage(m_handle, ref info);
                m_lastImage = new SonyImage(m_handle, info, personality, readoutMode, m_logger);
            }
            else
            {
                if (m_bulbMode)
                {
                    PropertyValue pv = new PropertyValue();
                    SetExposureTime(m_handle, (float)(duration > m_bulbModeTime ? 0 : duration), ref pv);
                }

                if (m_desiredGain != -1 && Gains.Count > 0)
                {
                    SetPropertyValue(m_handle, SonyCommon.PROPERTY_ISO, UInt32.Parse((string)Gains[m_desiredGain]));
                }

                StartCapture(m_handle, ref info);
                m_lastImage = new SonyImage(m_handle, info, personality, readoutMode, m_logger);
            }

            return(m_lastImage);
        }
Esempio n. 2
0
        public SonyImage StartCapture(double duration, int personality, short readoutMode)
        {
            ImageInfo info = new ImageInfo();

            if (m_lastImage != null)
            {
                m_lastImage.Cleanup();
                m_lastImage = null;
            }

            // 32-bit apps tend to run close to the line of memory
            // The auto garbage collection tends to fail when we're talking the large files
            // a 60MP camera can deliver, and an attempt to allocate more than is available doesn't
            // seem to trigger a collection - so we'll just do it here.
            // TODO: Make this conditional on 32-bit execution
            if (!Environment.Is64BitProcess)
            {
                GC.Collect();
            }

            info.Status       = STATUS_EXPOSING;
            info.ImageMode    = (uint)m_outputMode;
            info.ExposureTime = duration;

            if (Mode.Preview)
            {
                info.ImageMode = IMAGEMODE_RGB;
                GetPreviewImage(m_handle, ref info);
                m_lastImage = new SonyImage(m_handle, info, personality, readoutMode, m_logger);
            }
            else
            {
                StartCapture(m_handle, ref info);
                m_lastImage = new SonyImage(m_handle, info, personality, readoutMode, m_logger);
            }

            return(m_lastImage);
        }