public static AstroPlate FromReflectedObject(object reflObj) { var rv = new AstroPlate(); rv.m_ImageWidth = StarMap.GetPropValue <int>(reflObj, "m_ImageWidth"); rv.m_ImageHeight = StarMap.GetPropValue <int>(reflObj, "m_ImageHeight"); rv.m_MatrixToImageScaleX = StarMap.GetPropValue <double>(reflObj, "m_MatrixToImageScaleX"); rv.m_MatrixToImageScaleY = StarMap.GetPropValue <double>(reflObj, "m_MatrixToImageScaleY"); rv.EffectiveFocalLength = StarMap.GetPropValue <double>(reflObj, "EffectiveFocalLength"); rv.EffectivePixelWidth = StarMap.GetPropValue <double>(reflObj, "EffectivePixelWidth"); rv.EffectivePixelHeight = StarMap.GetPropValue <double>(reflObj, "EffectivePixelHeight"); object obj = StarMap.GetPropValue <object>(reflObj, "m_Matrix"); rv.m_Matrix = CCDMatrix.FromReflectedObject(obj); try { rv.m_BitPix = StarMap.GetPropValue <int>(reflObj, "BitPix"); } catch { rv.m_BitPix = 8; } return(rv); }
public void Test2_NearSouthPole() { var matrix = new CCDMatrix(8.6, 8.3, 752, 582); var astroPlate = new AstroPlate(matrix, 720, 576, 16); var userStars = new Dictionary<ImagePixel, IStar>(); var star1 = new TestStar(670000669, 14.040622402203727, -76.691539882008868, 13.389); var pixel1 = new ImagePixel(111.28789147012657, 170.18336583345945); userStars.Add(pixel1, star1); var star2 = new TestStar(680000642, 13.3447869927272, -76.594950217617452, 9.932); var pixel2 = new ImagePixel(575.00594900921817, 446.45890095859744); userStars.Add(pixel2, star2); var star3 = new TestStar(670000641, 13.550035599758042, -76.722167259223085, 13.842); var pixel3 = new ImagePixel(425.86138030460097, 63.057739094752051); userStars.Add(pixel3, star3); var newAstro = new ThreeStarAstrometry(astroPlate, userStars, 2); Assert.IsTrue(newAstro.Success); Assert.AreEqual(-76.6498, newAstro.DE0Deg, 0.0001); Assert.AreEqual(13.6644, newAstro.RA0Deg, 0.0001); double ra, de; newAstro.GetRADEFromImageCoords(111.28789147012657, 170.18336583345945, out ra, out de); Assert.AreEqual(14.0406224, ra, 0.0000001); Assert.AreEqual(-76.6915398, de, 0.0000001); double x, y; newAstro.GetImageCoordsFromRADE(14.040622402203727, -76.691539882008868, out x, out y); Assert.AreEqual(111.2879, x, 0.0001); Assert.AreEqual(170.1833, y, 0.0001); }
public AstroPlate(SerializationInfo info, StreamingContext context) { m_ImageWidth = info.GetInt32("m_ImageWidth"); m_ImageHeight = info.GetInt32("m_ImageHeight"); m_MatrixToImageScaleX = info.GetDouble("m_MatrixToImageScaleX"); m_MatrixToImageScaleY = info.GetDouble("m_MatrixToImageScaleY"); EffectiveFocalLength = info.GetDouble("EffectiveFocalLength"); EffectivePixelWidth = info.GetDouble("EffectivePixelWidth"); EffectivePixelHeight = info.GetDouble("EffectivePixelHeight"); byte[] data = (byte[])info.GetValue("m_Matrix", typeof(byte[])); BinaryFormatter fmt = new BinaryFormatter(); using (MemoryStream mem = new MemoryStream(data)) { m_Matrix = (CCDMatrix)fmt.Deserialize(mem); } try { m_BitPix = info.GetInt32("m_BitPix"); } catch { m_BitPix = 8; } }
public AstroPlate(SerializationInfo info, StreamingContext context) { m_ImageWidth = info.GetInt32("m_ImageWidth"); m_ImageHeight = info.GetInt32("m_ImageHeight"); m_MatrixToImageScaleX = info.GetDouble("m_MatrixToImageScaleX"); m_MatrixToImageScaleY = info.GetDouble("m_MatrixToImageScaleY"); EffectiveFocalLength = info.GetDouble("EffectiveFocalLength"); EffectivePixelWidth = info.GetDouble("EffectivePixelWidth"); EffectivePixelHeight = info.GetDouble("EffectivePixelHeight"); byte[] data = (byte[])info.GetValue("m_Matrix", typeof(byte[])); BinaryFormatter fmt = new BinaryFormatter(); using (MemoryStream mem = new MemoryStream(data)) { m_Matrix = (CCDMatrix)fmt.Deserialize(mem); } try { m_BitPix = info.GetInt32("m_BitPix"); } catch { m_BitPix = 8; } }
public static CCDMatrix FromReflectedObject(object reflObj) { var rv = new CCDMatrix(); rv.m_CellX = StarMap.GetPropValue <double>(reflObj, "m_CellX"); rv.m_CellY = StarMap.GetPropValue <double>(reflObj, "m_CellY"); rv.m_Width = StarMap.GetPropValue <int>(reflObj, "m_Width"); rv.m_Height = StarMap.GetPropValue <int>(reflObj, "m_Height"); return(rv); }
public AstroPlate Clone() { CCDMatrix clonedMatrix = new CCDMatrix(m_Matrix.CellX, m_Matrix.CellY, m_Matrix.Width, m_Matrix.Height); AstroPlate clone = new AstroPlate(clonedMatrix, m_ImageWidth, m_ImageHeight, m_BitPix); clone.EffectivePixelWidth = this.EffectivePixelWidth; clone.EffectivePixelHeight = this.EffectivePixelHeight; clone.EffectiveFocalLength = this.EffectiveFocalLength; return(clone); }
public static CCDMatrix FromReflectedObject(object reflObj) { var rv = new CCDMatrix(); rv.m_CellX = StarMap.GetPropValue<double>(reflObj, "m_CellX"); rv.m_CellY = StarMap.GetPropValue<double>(reflObj, "m_CellY"); rv.m_Width = StarMap.GetPropValue<int>(reflObj, "m_Width"); rv.m_Height = StarMap.GetPropValue<int>(reflObj, "m_Height"); return rv; }
public AstroPlate(CCDMatrix matrix, int imageWidth, int imageHeight, int BitPix) { m_BitPix = BitPix; m_Matrix = matrix; m_ImageWidth = imageWidth; m_ImageHeight = imageHeight; m_MatrixToImageScaleX = (double)m_ImageWidth / (double)m_Matrix.Width; m_MatrixToImageScaleY = (double)m_ImageHeight / (double)m_Matrix.Height; EffectivePixelWidth = m_Matrix.CellX * m_MatrixToImageScaleX; EffectivePixelHeight = m_Matrix.CellY * m_MatrixToImageScaleY; FullFrame = new Rectangle(0, 0, m_ImageWidth, m_ImageHeight); }
public AstroPlate(CCDMatrix matrix, int imageWidth, int imageHeight, int BitPix) { m_BitPix = BitPix; m_Matrix = matrix; m_ImageWidth = imageWidth; m_ImageHeight = imageHeight; m_MatrixToImageScaleX = (double)m_ImageWidth / (double)m_Matrix.Width; m_MatrixToImageScaleY = (double)m_ImageHeight / (double)m_Matrix.Height; EffectivePixelWidth = m_Matrix.CellX * m_MatrixToImageScaleX; EffectivePixelHeight = m_Matrix.CellY * m_MatrixToImageScaleY; FullFrame = new Rectangle(0, 0, m_ImageWidth, m_ImageHeight); }
public void Test1() { var matrix = new CCDMatrix(8.6, 8.3, 752, 582); var astroPlate = new AstroPlate(matrix, 720, 576, 8); var userStars = new Dictionary<ImagePixel, IStar>(); var star1 = new TestStar(2890001240, 18.528885242458674, -32.262447583319769, 11.033); var pixel1 = new ImagePixel(72.0519465443632, 240.48754416283302); userStars.Add(pixel1, star1); var star2 = new TestStar(2890001234, 18.353495385568369, -32.296976944037546, 12.294); var pixel2 = new ImagePixel(421.79863331879409, 329.57539665223919); userStars.Add(pixel2, star2); var star3 = new TestStar(2890001229, 18.284537781225755, -32.213242615932892, 10.882); var pixel3 = new ImagePixel(559.51676838260289, 114.86160161500557); userStars.Add(pixel3, star3); var plateSolve = DirectTransRotAstrometry.SolveByThreeStars(astroPlate, userStars, 2); Assert.IsNotNull(plateSolve); Assert.AreEqual(1.2836, plateSolve.Aspect, 0.0001); Assert.AreEqual(-32.2808, plateSolve.DE0Deg, 0.0001); Assert.AreEqual(18.3845, plateSolve.RA0Deg, 0.0001); Assert.AreEqual(179.9401, plateSolve.EtaDeg, 0.0001); Assert.AreEqual(0.00, plateSolve.Residual, 0.01); var newAstro = new ThreeStarAstrometry(astroPlate, userStars, 2); Assert.IsTrue(newAstro.Success); Assert.AreEqual(-32.2808, newAstro.DE0Deg, 0.0001); Assert.AreEqual(18.3845, newAstro.RA0Deg, 0.0001); double ra, de; newAstro.GetRADEFromImageCoords(72.0519465443632, 240.48754416283302, out ra, out de); Assert.AreEqual(18.5288852, ra, 0.0000001); Assert.AreEqual(-32.2624475, de, 0.0000001); double x, y; newAstro.GetImageCoordsFromRADE(18.528885242458674, -32.262447583319769, out x, out y); Assert.AreEqual(72.0519, x, 0.0001); Assert.AreEqual(240.4875, y, 0.0001); }
public AstroPlate GetCurrentAstroPlate() { CCDMatrix matrix; if (AstrometryContext.Current.VideoCamera == null) { // This is used for the case where no configuration has been loaded. matrix = new CCDMatrix(1, 1, TangraContext.Current.FrameWidth, TangraContext.Current.FrameHeight); } else matrix = new CCDMatrix( AstrometryContext.Current.VideoCamera.CCDMetrics.CellWidth, AstrometryContext.Current.VideoCamera.CCDMetrics.CellHeight, AstrometryContext.Current.VideoCamera.CCDMetrics.MatrixWidth, AstrometryContext.Current.VideoCamera.CCDMetrics.MatrixHeight); AstroPlate image = new AstroPlate(matrix, TangraContext.Current.FrameWidth, TangraContext.Current.FrameHeight, m_VideoController.VideoBitPix); if (AstrometryContext.Current.PlateConstants != null) { image.EffectivePixelWidth = AstrometryContext.Current.PlateConstants.EffectivePixelWidth; image.EffectivePixelHeight = AstrometryContext.Current.PlateConstants.EffectivePixelHeight; image.EffectiveFocalLength = AstrometryContext.Current.PlateConstants.EffectiveFocalLength; } return image; }
public AstroPlate Clone() { CCDMatrix clonedMatrix = new CCDMatrix(m_Matrix.CellX, m_Matrix.CellY, m_Matrix.Width, m_Matrix.Height); AstroPlate clone = new AstroPlate(clonedMatrix, m_ImageWidth, m_ImageHeight, m_BitPix); clone.EffectivePixelWidth = this.EffectivePixelWidth; clone.EffectivePixelHeight = this.EffectivePixelHeight; clone.EffectiveFocalLength = this.EffectiveFocalLength; return clone; }