public Pixelmap GetIntegratedFrame(int startFrameNo, int framesToIntegrate, bool isSlidingIntegration, bool isMedianAveraging) { if (startFrameNo < 0 || startFrameNo >= m_FirstFrame + m_CountFrames) { throw new ApplicationException("Invalid frame position: " + startFrameNo); } int actualFramesToIntegrate = Math.Min(startFrameNo + framesToIntegrate, m_FirstFrame + m_CountFrames - 1) - startFrameNo; uint[] pixels = new uint[m_Width * m_Height]; uint[] unprocessedPixels = new uint[m_Width * m_Height]; byte[] displayBitmapBytes = new byte[m_Width * m_Height]; byte[] rawBitmapBytes = new byte[(m_Width * m_Height * 3) + 40 + 14 + 1]; var frameInfo = new AdvFrameInfoNative(); lock (m_SyncLock) { TangraCore.ADVGetIntegratedFrame(startFrameNo, actualFramesToIntegrate, isSlidingIntegration, isMedianAveraging, pixels, unprocessedPixels, rawBitmapBytes, displayBitmapBytes, frameInfo); } m_CurrentFrameInfo = new AdvFrameInfo(frameInfo); using (MemoryStream memStr = new MemoryStream(rawBitmapBytes)) { Bitmap displayBitmap = (Bitmap)Bitmap.FromStream(memStr); var rv = new Pixelmap(m_Width, m_Height, m_BitPix, pixels, displayBitmap, displayBitmapBytes); rv.SetMaxSignalValue(m_Aav16NormVal); rv.UnprocessedPixels = unprocessedPixels; return(rv); } }
public FrameStateData GetFrameStatusChannel(int index) { if (index >= m_FirstFrame + m_CountFrames) { throw new ApplicationException("Invalid frame position: " + index); } var frameInfo = new AdvFrameInfoNative(); byte[] gpsFix = new byte[256 * 16]; byte[] userCommand = new byte[256 * 16]; byte[] systemError = new byte[256 * 16]; lock (m_SyncLock) { TangraCore.ADVGetFrameStatusChannel(index, frameInfo, gpsFix, userCommand, systemError); } var frameStatusChannel = new AdvFrameInfo(frameInfo); frameStatusChannel.UserCommandString = AdvFrameInfo.GetStringFromBytes(userCommand); frameStatusChannel.SystemErrorString = AdvFrameInfo.GetStringFromBytes(systemError); frameStatusChannel.GPSFixString = AdvFrameInfo.GetStringFromBytes(gpsFix); return(AdvFrameInfoToFrameStateData(frameStatusChannel, index)); }
public AdvFrameInfo GetStatusChannel(int index) { var frameInfo = new AdvFrameInfoNative(); byte[] gpsFix = new byte[256 * 16]; byte[] userCommand = new byte[256 * 16]; byte[] systemError = new byte[256 * 16]; lock (m_SyncLock) { TangraCore.ADVGetFrameStatusChannel(index, frameInfo, gpsFix, userCommand, systemError); } var rv = new AdvFrameInfo(frameInfo) { UserCommandString = AdvFrameInfo.GetStringFromBytes(userCommand), SystemErrorString = AdvFrameInfo.GetStringFromBytes(systemError), GPSFixString = AdvFrameInfo.GetStringFromBytes(gpsFix) }; return(rv); }
public Pixelmap GetPixelmap(int index) { if (index >= m_FirstFrame + m_CountFrames) { throw new ApplicationException("Invalid frame position: " + index); } uint[] pixels = new uint[m_Width * m_Height]; uint[] unprocessedPixels = new uint[m_Width * m_Height]; byte[] displayBitmapBytes = new byte[m_Width * m_Height]; byte[] rawBitmapBytes = new byte[(m_Width * m_Height * 3) + 40 + 14 + 1]; var frameInfo = new AdvFrameInfoNative(); byte[] gpsFix = new byte[256 * 16]; byte[] userCommand = new byte[256 * 16]; byte[] systemError = new byte[256 * 16]; lock (m_SyncLock) { TangraCore.ADVGetFrame(index, pixels, unprocessedPixels, rawBitmapBytes, displayBitmapBytes, frameInfo, gpsFix, userCommand, systemError); } m_CurrentFrameInfo = new AdvFrameInfo(frameInfo); m_CurrentFrameInfo.UserCommandString = AdvFrameInfo.GetStringFromBytes(userCommand); m_CurrentFrameInfo.SystemErrorString = AdvFrameInfo.GetStringFromBytes(systemError); m_CurrentFrameInfo.GPSFixString = AdvFrameInfo.GetStringFromBytes(gpsFix); if (m_Engine == "AAV" && m_CurrentFrameInfo.IntegratedFrames > 0 && TangraConfig.Settings.AAV.SplitFieldsOSD && m_OsdFirstLine * m_OsdLastLine != 0) { TangraCore.BitmapSplitFieldsOSD(rawBitmapBytes, m_OsdFirstLine, m_OsdLastLine); } if (frameInfo.HasNtpTimeStamp && m_CurrentFrameInfo.Exposure10thMs == 0 && index + 1 < m_FirstFrame + m_CountFrames) { lock (m_SyncLock) { TangraCore.ADVGetFrameStatusChannel(index + 1, frameInfo, gpsFix, userCommand, systemError); } if (frameInfo.HasNtpTimeStamp) { m_CurrentFrameInfo.Exposure10thMs = (int)Math.Round(new TimeSpan(frameInfo.EndExposureNtpTimeStamp.Ticks - m_CurrentFrameInfo.EndExposureNtpTimeStamp.Ticks).TotalMilliseconds * 10); } } using (MemoryStream memStr = new MemoryStream(rawBitmapBytes)) { Bitmap displayBitmap; if (m_Engine == "AAV" && m_CurrentFrameInfo.IntegratedFrames == 0) { // This is a VTI Split reference frame. Put some mark on it to mark it as such?? displayBitmap = Pixelmap.ConstructBitmapFromBitmapPixels(pixels, m_Width, m_Height); for (int i = 0; i < pixels.Length; i++) { displayBitmapBytes[i] = (byte)pixels[i]; } } else { try { displayBitmap = (Bitmap)Bitmap.FromStream(memStr); } catch (Exception ex) { Trace.WriteLine(ex.GetFullStackTrace()); displayBitmap = new Bitmap(m_Width, m_Height); } } var rv = new Pixelmap(m_Width, m_Height, m_BitPix, pixels, displayBitmap, displayBitmapBytes); rv.SetMaxSignalValue(m_Aav16NormVal); rv.FrameState = GetCurrentFrameState(index); rv.UnprocessedPixels = unprocessedPixels; return(rv); } }