private void btnNewConfig_Click(object sender, EventArgs e) { if (cbxSavedCameras.SelectedItem != null) { VideoCamera camera = cbxSavedCameras.SelectedItem as VideoCamera; frmEditConfigName frmNewConfig = new frmEditConfigName(null, camera, FrameWidth, FrameHeight, null); if (frmNewConfig.ShowDialog(this) == DialogResult.OK) { m_SelectedScopeRecorder = frmNewConfig.Config.Title; TangraConfig.ScopeRecorderConfiguration entry = TangraConfig.Settings.PlateSolve.ScopeRecorders.FirstOrDefault(r => r.Title == m_SelectedScopeRecorder); if (frmNewConfig.PltConst != null) { Rectangle plateRect = new Rectangle(0, 0, TangraContext.Current.FrameWidth, TangraContext.Current.FrameHeight); TangraConfig.PersistedPlateConstants pltConst = new TangraConfig.PersistedPlateConstants(); pltConst.EffectiveFocalLength = frmNewConfig.PltConst.EffectiveFocalLength; pltConst.EffectivePixelWidth = frmNewConfig.PltConst.EffectivePixelWidth; pltConst.EffectivePixelHeight = frmNewConfig.PltConst.EffectivePixelHeight; TangraConfig.Settings.PlateSolve.SetPlateConstants(camera, entry, plateRect, pltConst); TangraConfig.Settings.Save(); } ReloadScopeRecorders(); CheckSolvedPlateConstants(camera, entry); } } else { cbxSavedCameras.Focus(); } }
private void UpdateCurrentConfigValues() { VideoCamera camera = cbxSavedCameras.SelectedItem as VideoCamera; TangraConfig.ScopeRecorderConfiguration config = cbxSavedConfigurations.SelectedItem as TangraConfig.ScopeRecorderConfiguration; if (camera != null && config != null && !m_Setting) { Rectangle rawFrame = config.RawFrameSizes[camera.Model]; if (rawFrame == Rectangle.Empty) { config.RawFrameSizes[camera.Model] = new Rectangle(0, 0, FrameWidth, FrameHeight); } #if ASTROMETRY_DEBUG Trace.Assert(config.RawFrameSizes[camera.Model].Width == FrameWidth); Trace.Assert(config.RawFrameSizes[camera.Model].Height == FrameHeight); #endif m_LimitingMagnitudeChanged = config.LimitingMagnitudes[camera.Model] != (double)nudLimitMagnitude.Value; config.LimitingMagnitudes[camera.Model] = (double)nudLimitMagnitude.Value; config.FlipVertically = cbxFlipVertically.Checked; config.FlipHorizontally = cbxFlipHorizontally.Checked; TangraConfig.Settings.Save(); } }
private void btnEditConfiguration_Click(object sender, EventArgs e) { TangraConfig.ScopeRecorderConfiguration entry = cbxSavedConfigurations.SelectedItem as TangraConfig.ScopeRecorderConfiguration; VideoCamera camera = cbxSavedCameras.SelectedItem as VideoCamera; Rectangle plateRect = new Rectangle(0, 0, TangraContext.Current.FrameWidth, TangraContext.Current.FrameHeight); TangraConfig.PersistedPlateConstants pltConst = TangraConfig.Settings.PlateSolve.GetPlateConstants(camera, entry, plateRect); if (entry != null && camera != null) { frmEditConfigName frmNewConfig = new frmEditConfigName(entry, camera, FrameWidth, FrameHeight, pltConst); if (frmNewConfig.ShowDialog(this) == DialogResult.OK) { m_SelectedScopeRecorder = frmNewConfig.Config.Title; if (frmNewConfig.UpdatePlateConstants && frmNewConfig.PltConst != null) { pltConst = frmNewConfig.PltConst; TangraConfig.Settings.PlateSolve.SetPlateConstants(camera, entry, plateRect, pltConst); } ReloadScopeRecorders(); CheckSolvedPlateConstants(camera, entry); } } }
public async Task <string> AnalyzeImageProcessAsync(VideoCamera videoCamera, ImageProcess imageProcess, AnalyzeRequest analyzeRequest) { var connectionApiData = new ConnectionApiData { Location = analyzeRequest.Location, SubscriptionKey = analyzeRequest.SubscriptionKey }; Languages enumLanguages = (Languages)analyzeRequest.IdLanguages; RequestType enumRequestTypes = (RequestType)analyzeRequest.TypeCode; switch (enumRequestTypes) { case RequestType.SceneChange: return(string.Empty); case RequestType.Face: return(await AnalyzeFace(imageProcess.ImageFile, videoCamera.IdPersonGroupsAPI, connectionApiData)); case RequestType.Carplate: return(await AnalyzeCarPlate(enumLanguages.ToString(), imageProcess.ImageFile, connectionApiData)); case RequestType.ImageDescription: return(await AnalyzeImageDescription(enumLanguages.ToString(), imageProcess.ImageFile, connectionApiData)); } return(null); }
private void MouseFixHook(On.VideoCamera.orig_Update orig, VideoCamera self) { orig(self); var m_active = GetValue(typeof(VideoCamera), self, "m_active"); var m_character = GetValue(typeof(VideoCamera), self, "m_character"); if (m_active is bool active && m_character is Character character) { if (active == false && character != null) { if (freeCameraFlag && localPlayerID == -1) { localPlayerID = ControlsInput.GetMouseOwner(); } if (!freeCameraFlag) { freeCameraFlag = true; Cursor.lockState = CursorLockMode.Locked; if (localPlayerID != -1) { ControlsInput.AssignMouseKeyboardToPlayer(localPlayerID); } } } if (active == true && freeCameraFlag == true) { freeCameraFlag = false; } } }
public SimCorpMobile(IOutput output) { Output = output; vModelName = "SimCorp Mobile"; vBattery = new LiIonBattery(3000, 1500); vSpeaker = new StereoSpeakerSystem(new RealSpeaker(2), new RealSpeaker(2), 40, this.Output); vSpeakerName = nameof(StereoSpeakerSystem); vKeyBoard = new TouchScreenKeyboard(); vMicrophone = new MobileMicrophone(); vSimCard = new DualSimCardSlot(SimCardTypes.MicroSimCard, SimCardTypes.NanoSimCard); vScreen = new OLEDScreen(1280, 720, 280); vMainCamera = new VideoCamera("Main", 13, true, true); vFrontalCamera = new VideoCamera("Frontal", 5, true, true); vCallStor = new CallStorage(); Contact contact1 = new Contact("Taras", new List <string> { "0633333333", "0966666666" }); Contact contact2 = new Contact("Jeeves", "0674612131"); Contact contact3 = new Contact("Wooster", "0503322189"); vContactStor = new ContactStorage(new List <Contact> { contact1, contact2, contact3 }); CallGen = new CallGenerator(vContactStor); CallGen.CallReceived += OnCallReceived; }
public frmEditCamera(VideoCamera camera) { InitializeComponent(); if (camera == null) { m_New = true; m_Camera = new VideoCamera(); m_Camera.Model = "<new camera>"; m_InitialCameraModel = null; } else { m_New = false; m_Camera = camera; m_InitialCameraModel = m_Camera.Model; } tbxCameraName.Text = m_Camera.Model; tbxPixelX.Text = m_Camera.CCDMetrics.CellWidth.ToString("0.0"); tbxPixelY.Text = m_Camera.CCDMetrics.CellWidth.ToString("0.0"); tbxMatrixWidth.Text = m_Camera.CCDMetrics.MatrixWidth.ToString(); tbxMatrixHeight.Text = m_Camera.CCDMetrics.MatrixHeight.ToString(); cbxUsesIntegration.Checked = m_Camera.Integrating; tbxCameraName.Enabled = !m_Camera.ReadOnly; tbxPixelX.Enabled = !m_Camera.ReadOnly; tbxPixelY.Enabled = !m_Camera.ReadOnly; tbxMatrixWidth.Enabled = !m_Camera.ReadOnly; tbxMatrixHeight.Enabled = !m_Camera.ReadOnly; cbxUsesIntegration.Enabled = !m_Camera.ReadOnly; }
public VideoRecordingSucceedsWithCameraOnly( VideoRecording aVideoRecording, VideoCamera aCamera) { videoRecording = aVideoRecording; camera = aCamera; }
internal static Camera CreateCamera(OperationType operationType, StoreMediaOptions storeOptions) { if (Cameras.TryGetValue(operationType, out Camera camera)) { return(camera); } switch (operationType) { case OperationType.Photo: camera = new PhotoCamera(storeOptions); Cameras[OperationType.Photo] = camera; break; case OperationType.Video: camera = new VideoCamera(storeOptions); Cameras[OperationType.Video] = camera; break; default: throw new ArgumentOutOfRangeException(nameof(operationType), operationType, null); } return(camera); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { System.Diagnostics.Debug.WriteLine("OnNavigatedTo "); cam = new VideoCamera( CameraSource.PrimaryCamera ); cam.Initialized += new EventHandler(cam_Initialized); visualer = new CameraVisualizer(); visualer.SetSource(cam); }
public void ShouldBeRecordingWhenUsedForVideoRecording( VideoCamera videoCamera, ActivityId videoRecording) { videoCamera.UseForVideoRecording(videoRecording); videoCamera.IsInRole(RoleInActivity.Recording(videoRecording)).ShouldBeTrue(); }
public Video() { Properties.Settings.Default.Reload(); aviTools = new AviTools(); camera = new VideoCamera(aviTools); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { System.Diagnostics.Debug.WriteLine("OnNavigatedTo "); cam = new VideoCamera(CameraSource.PrimaryCamera); cam.Initialized += new EventHandler(cam_Initialized); visualer = new CameraVisualizer(); visualer.SetSource(cam); }
public VideoRecordingFailsWithoutCamera( VideoRecording aVideoRecording, VideoCamera aCamera, Microphone aMicrophone) { videoRecording = aVideoRecording; camera = aCamera; microphone = aMicrophone; }
public Video() { aviTools = new AviTools(); Properties.Settings.Default.Reload(); camera = new VideoCamera(aviTools); TraceSwitches.DebugTracing.Level = Properties.Settings.Default.TraceLevel; }
public void CannotUseForVideoRecordingWhenAlreadyRecording( VideoCamera videoCamera, ActivityId previousVideoRecording, ActivityId newVideoRecording) { videoCamera.UseForVideoRecording(previousVideoRecording); videoCamera.UseForVideoRecording(newVideoRecording).ShouldBeFalse(); }
public void Dispose() { if (camera != null && camera.IsConnected) { camera.EnsureDisconnected(); } camera = null; }
public VideoRecordingSucceedsWithCameraAndMicrophone( VideoRecording aVideoRecording, VideoCamera aCamera, Microphone aMicrophone) { videoRecording = aVideoRecording; camera = aCamera; microphone = aMicrophone; }
public void TestCameras() { Order o = new PhotoCamera(); Assert.AreEqual(1200, o.cost()); Order order = new VideoCamera(); Assert.AreEqual(1700, order.cost()); }
public SimCorpMobile() { vModelName = "SimCorp Mobile"; vBattery = new LiIonBattery(3000); vSpeaker = new StereoSpeakerSystem(new RealSpeaker(2), new RealSpeaker(2), 40); vKeyBoard = new TouchScreenKeyboard(); vMicrophone = new MobileMicrophone(); vSimCard = new DualSimCardSlot(SimCardTypes.MicroSimCard, SimCardTypes.NanoSimCard); vScreen = new OLEDScreen(1280, 720, 280); vMainCamera = new VideoCamera("Main", 13, true, true); vFrontalCamera = new VideoCamera("Frontal", 5, true, true); }
public frmEditConfigName( TangraConfig.ScopeRecorderConfiguration config, VideoCamera camera, int frameWidth, int frameHeight, TangraConfig.PersistedPlateConstants pltConst) { InitializeComponent(); m_FrameWidth = frameWidth; m_FrameHeight = frameHeight; if (config == null) { config = new TangraConfig.ScopeRecorderConfiguration(camera.Model, frameWidth, frameHeight); tbxConfigName.Enabled = true; m_New = true; Height = 260; pnlSolvedPlateConf.Visible = false; cbxEditConfig.Visible = false; pnlOSDAreaConf.Visible = false; cbxEditOSDArea.Visible = false; } else { tbxConfigName.Enabled = false; Height = 396; pnlSolvedPlateConf.Visible = true; cbxEditConfig.Visible = true; if (pltConst != null) { tbxSolvedCellX.Text = pltConst.EffectivePixelWidth.ToString(); tbxSolvedCellY.Text = pltConst.EffectivePixelHeight.ToString(); tbxSolvedFocalLength.Text = pltConst.EffectiveFocalLength.ToString(); } } cbxAreaType.SelectedIndex = config.IsInclusionArea ? 1 : 0; if (config.IsInclusionArea) { SetOSDDimentions(config.InclusionArea); } else { SetOSDDimentions(config.OSDExclusionArea); } m_Config = config; m_Camera = camera; tbxConfigName.Text = config.Title; m_PltConst = pltConst; }
private void CheckSolvedPlateConstants(VideoCamera camera, TangraConfig.ScopeRecorderConfiguration config) { TangraConfig.PersistedPlateConstants pltCopnst = TangraConfig.Settings.PlateSolve.GetPlateConstants( camera, config, new Rectangle(0, 0, TangraContext.Current.FrameWidth, TangraContext.Current.FrameHeight)); if (pltCopnst == null) { gbxSolved.Visible = false; pnlNotSolved.Visible = true; cbxSolveConstantsNow.Checked = true; cbxSolveConstantsNow.Visible = true; } else { gbxSolved.Visible = true; cbxSolveConstantsNow.Checked = false; pnlNotSolved.Visible = false; tbxSolvedCellX.Text = pltCopnst.EffectivePixelWidth.ToString("0.000"); tbxSolvedCellY.Text = pltCopnst.EffectivePixelHeight.ToString("0.000"); tbxSolvedFocalLength.Text = pltCopnst.EffectiveFocalLength.ToString("0.0"); Rectangle rect = config.IsInclusionArea ? config.InclusionArea : config.OSDExclusionArea; lblConfigAreaInfo.Text = string.Format("{0} Area [({1},{2})-({3},{4})]", config.IsInclusionArea ? "Inclusion" : "Exclusion", rect.Left, rect.Top, rect.Right, rect.Bottom); } pnlEditableConfigSettings.Visible = true; toolTip.SetToolTip(lblLimitingMagnitude, string.Format(" The limiting magnitude when {0}\r\nis used with this configuration", camera.Model)); toolTip.SetToolTip(nudLimitMagnitude, string.Format(" The limiting magnitude when {0}\r\nis used with this configuration", camera.Model)); m_Setting = true; try { nudLimitMagnitude.Value = (decimal)config.LimitingMagnitudes[camera.Model]; m_LimitingMagnitudeChanged = false; cbxFlipVertically.Checked = config.FlipVertically; cbxFlipHorizontally.Checked = config.FlipHorizontally; } finally { m_Setting = false; } }
private void btnEditCamera_Click(object sender, EventArgs e) { VideoCamera camera = cbxSavedCameras.SelectedItem as VideoCamera; if (camera != null) { frmEditCamera frmNewCamera = new frmEditCamera(camera); if (frmNewCamera.ShowDialog(this) == DialogResult.OK) { m_SelectedCamera = frmNewCamera.Camera.Model; ReloadCameras(); } } }
private ArrayList MyListOfStuff; //Declare our list of stuff void Start() { if (WindowVisible == true) { //SETUP the camera VideoCamera.Initialize(); string[] properties = VideoCamera.getAvailablePropertyStrings(); //MyListOfStuff = new List<string>(); //Initialize our list of stuff MyListOfStuff = new ArrayList(); //Initialize our list of stuff for (int i = 0; i < properties.Length; i++) //Fill it with some stuff { MyListOfStuff.Add(properties[i]); } } }
public SimCorpMobile(IOutput output) { Output = output; vModelName = "SimCorp Mobile"; vBattery = new LiIonBattery(3000, 1500); vSpeaker = new StereoSpeakerSystem(new RealSpeaker(2), new RealSpeaker(2), 40, this.Output); vSpeakerName = nameof(StereoSpeakerSystem); vKeyBoard = new TouchScreenKeyboard(); vMicrophone = new MobileMicrophone(); vSimCard = new DualSimCardSlot(SimCardTypes.MicroSimCard, SimCardTypes.NanoSimCard); vScreen = new OLEDScreen(1280, 720, 280); vMainCamera = new VideoCamera("Main", 13, true, true); vFrontalCamera = new VideoCamera("Frontal", 5, true, true); SMSProvider = new SMSProvider(); vMsgStor = new MsgStorage(); SMSProvider.SMSReceived += OnSMSReceived; }
public void TestDecorators() { Order o = new PhotoCamera(); o = new Lens(o); Assert.AreEqual(o.cost(), 1799); o = new Filter(o); Assert.AreEqual(o.cost(), 1822.50); o = new Extender(o); Assert.AreEqual(o.cost(), 2251.50); Order order = new VideoCamera(); order = new Lens(order); Assert.AreEqual(order.cost(), 2299); order = new Filter(order); Assert.AreEqual(order.cost(), 2322.50); order = new Extender(order); Assert.AreEqual(order.cost(), 2751.50); }
private void cbxSavedCameras_SelectedIndexChanged(object sender, EventArgs e) { VideoCamera camera = cbxSavedCameras.SelectedItem as VideoCamera; if (camera == null) { tbxPixelX.Text = string.Empty; tbxPixelY.Text = string.Empty; tbxMatrixWidth.Text = string.Empty; tbxMatrixHeight.Text = string.Empty; } else { tbxPixelX.Text = camera.CCDMetrics.CellWidth.ToString("0.0#"); tbxPixelY.Text = camera.CCDMetrics.CellHeight.ToString("0.0#"); tbxMatrixWidth.Text = camera.CCDMetrics.MatrixWidth.ToString(); tbxMatrixHeight.Text = camera.CCDMetrics.MatrixHeight.ToString(); } UpdateEnabledDisabledState(); }
private void UpdateEnabledDisabledState() { VideoCamera camera = cbxSavedCameras.SelectedItem as VideoCamera; TangraConfig.ScopeRecorderConfiguration config = cbxSavedConfigurations.SelectedItem as TangraConfig.ScopeRecorderConfiguration; if (OnUpdateEnabledDisabledState != null) { OnUpdateEnabledDisabledState.Invoke(camera != null && config != null); } if (camera != null && config != null) { CheckSolvedPlateConstants(camera, config); } else { gbxSolved.Visible = false; pnlEditableConfigSettings.Visible = false; pnlNotSolved.Visible = false; } }
private void btnDelete_Click(object sender, EventArgs e) { VideoCamera camera = cbxSavedCameras.SelectedItem as VideoCamera; if (camera != null) { if (MessageBox.Show(this, string.Format("Are you sure you want to delete '{0}'", camera.Model), "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { TangraConfig.Settings.PlateSolve.VideoCameras.Remove(camera); if (TangraConfig.Settings.PlateSolve.SelectedCameraModel == camera.Model) { TangraConfig.Settings.PlateSolve.SelectedCameraModel = null; } TangraConfig.Settings.Save(); m_SelectedCamera = null; ReloadCameras(); } } }
public void ShouldBeAvailableWhenConstructed(VideoCamera videoCamera) { videoCamera.IsAvailable().ShouldBeTrue(); }
private void InitializedCamera() { camera = new VideoCamera(); camera.Initialized += OnCameraInitialized; cameraVisualizer.SetSource(camera); }
internal ChooseConfigurationResult VerifyCameraSettings() { VideoCamera camera = cbxSavedCameras.SelectedItem as VideoCamera; TangraConfig.ScopeRecorderConfiguration config = cbxSavedConfigurations.SelectedItem as TangraConfig.ScopeRecorderConfiguration; if (camera != null && config != null) { if (cbxRecalibrate.Checked) { return(new ChooseConfigurationResult() { SolvePlateConstantsNow = true, SelectedCameraModel = camera.Model, SelectedConfigName = config.Title, Recalibrate = true }); } Rectangle rawFrame = config.RawFrameSizes[camera.Model]; if (rawFrame == Rectangle.Empty) { rawFrame = new Rectangle(0, 0, FrameWidth, FrameHeight); config.RawFrameSizes[camera.Model] = rawFrame; } m_LimitingMagnitudeChanged |= config.LimitingMagnitudes[camera.Model] != (double)nudLimitMagnitude.Value; config.LimitingMagnitudes[camera.Model] = (double)nudLimitMagnitude.Value; if (m_LimitingMagnitudeChanged && config.LimitingMagnitudes[camera.Model] < 13) { MessageBox.Show("Your limitting magnitude may result in too few stars being used for a fit. Unless your field of view is a degree or more it is recommended to use at least limitting magnitude of 13.\r\n\r\nThe limiting magnitude has the meaning of 'What is the faintest star you can record with this equipment using the maximum useful exposure'. For non integrating video cameras it is recommended to use one magnitude fainter than what you have determined experimentally to be your limiting magnitude.", "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Warning); m_LimitingMagnitudeChanged = false; } config.FlipVertically = cbxFlipVertically.Checked; config.FlipHorizontally = cbxFlipHorizontally.Checked; TangraConfig.Settings.Save(); if (rawFrame.Height != FrameHeight || rawFrame.Width != FrameWidth) { MessageBox.Show( "The opened video frame size is incompatible with the selected configuration. May be " + "the recording equipment is different? Please create a new configuration.", "Wrong Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error); cbxSavedConfigurations.Focus(); return(null); } else if (rawFrame == Rectangle.Empty) { // This is an existing configuration with no parameters for this frame size, so create one config.RawFrameSizes[camera.Model] = new Rectangle(0, 0, FrameWidth, FrameHeight); } var rv = new ChooseConfigurationResult() { IsNew = config.IsNew, SolvePlateConstantsNow = cbxSolveConstantsNow.Checked, SelectedCameraModel = camera.Model, SelectedConfigName = config.Title }; return(rv); } return(null); }