internal ChasingCameraConfig(IWorldObject chasedObject) { _cameraConfig = new CameraConfig(); _chasedObject = chasedObject; _positionOffset = Vector3.Backward; _lookAtOffset = Vector3.Zero; }
internal static Camera Create(CameraProfile profile, CameraConfig config) { switch (profile.FilterType) { case FilterType.LocalCamera: return(Create(profile, config, new VideoCaptureDeviceVideoSource(config.OriginalSourceString) { DesiredFrameRate = 10000000 / config.FrameRate, // 1 fps, 30 fps = 10000000 / 30 = 333333 DesiredFrameSize = new System.Drawing.Size(config.Resolution.Width, config.Resolution.Height), DesiredSnapshotSize = new System.Drawing.Size(config.Resolution.Width, config.Resolution.Height), })); case FilterType.LocalDesktop: return(Create(profile, config, new DesktopVideoSource(int.Parse(config.OriginalSourceString, CultureInfo.InvariantCulture)) { FrameInterval = config.FrameInterval, // default 1000 == 1 fps, 30 fps = 1000 / 30 = 33 IsResized = true, ResizeWidth = config.Resolution.Width, ResizeHeight = config.Resolution.Height, })); case FilterType.LocalAVIFile: return(Create(profile, config, new FileVideoSource(config.OriginalSourceString))); case FilterType.NetworkJPEG: return(Create(profile, config, new JpegVideoSource(config.OriginalSourceString) { FrameInterval = config.FrameInterval, HttpUserAgent = config.UserAgent, Login = config.UserName, Password = config.Password, })); case FilterType.NetworkMJPEG: return(Create(profile, config, new MJpegVideoSource(config.OriginalSourceString) { HttpUserAgent = config.UserAgent, Login = config.UserName, Password = config.Password, })); default: throw new NotSupportedException("Do not support the given filter type " + profile.FilterType.ToString()); } }
public DrivePoseMotor(ECameraPoseMode modeId, CameraConfig config, HashSet <ECameraPoseMode> excludes, VehicleContext vehicleContext, FreeMoveContext freeMoveContext ) { _modeId = (short)modeId; this.excludes = new HashSet <short>(); foreach (var e in excludes) { this.excludes.Add((short)e); } _config = config.GetCameraConfigItem(modeId); CameraActionManager.AddAction(CameraActionType.Enter, SubCameraMotorType.Pose, (int)modeId, (player, state) => { if (player.IsOnVehicle()) { var vehicle = vehicleContext.GetEntityWithEntityKey(player.controlledVehicle.EntityKey); player.controlledVehicle.CameraAnchorOffset = vehicle.vehicleAssetInfo.CameraAnchorOffset; player.controlledVehicle.CameraDistance = vehicle.vehicleAssetInfo.CameraDistance; player.controlledVehicle.CameraRotationDamping = vehicle.vehicleAssetInfo.CameraRotationDamping; } var cameraEulerAngle = player.cameraFinalOutputNew.EulerAngle; var carEulerAngle = player.cameraArchor.ArchorEulerAngle; var t = cameraEulerAngle - carEulerAngle; state.FreeYaw = t.y; state.FreePitch = t.x; }); CameraActionManager.AddAction(CameraActionType.Leave, SubCameraMotorType.Pose, (int)modeId, (player, state) => { var rotation = player.cameraFinalOutputNew.EulerAngle; player.orientation.Yaw = YawPitchUtility.Normalize(rotation.y); player.orientation.Pitch = YawPitchUtility.Normalize(rotation.x); state.LastFreePitch = 0; state.LastFreeYaw = 0; state.FreeYaw = 0f; state.FreePitch = 0f; }); }
public CameraService(CameraConfig config, CancellationTokenSource cancelSource) { _config = config; _cancelSource = cancelSource; _capture = VideoCapture.FromCamera(config.Index); _capture.Fps = config.Fps; _capture.FrameHeight = config.Height; _capture.FrameWidth = config.Width; if (config.Render) { _window = new Window("SecurityCam"); } }
public CameraConfig GetCameraConfig(CameraID cameraID) { List <CameraConfig> list = m_CameraConfigData.Configs; bool find = false; for (int i = 0; i < list.Count; i++) { CameraConfig config = list[i]; if (config.ID == (int)cameraID) { return(config); } } return(null); }
public CameraConfig GetCameraConfig() { IntPtr cameraConfigHandle = m_NativeSession.CameraConfigApi.Create(); if (InstantPreviewManager.IsProvidingPlatform) { InstantPreviewManager.LogLimitedSupportMessage("access camera config"); return(new CameraConfig()); } ExternApi.ArSession_getCameraConfig(m_NativeSession.SessionHandle, cameraConfigHandle); CameraConfig currentCameraConfig = _CreateCameraConfig(cameraConfigHandle); m_NativeSession.CameraConfigApi.Destroy(cameraConfigHandle); return(currentCameraConfig); }
public void SetupCameras(Game.CameraMode cameraMode, Team[] teams) { CameraConfig cameraConfig = null; for (int i = 0; i < Game.Config.cameras.Length; i++) { if (Game.Config.cameras[i].mode == cameraMode) { cameraConfig = Game.Config.cameras[i]; break; } } if (cameraConfig == null) { Debug.LogError("Unable to find config for camera mode <" + cameraMode.ToString() + ">"); } else { //Spawn cameras based on mode if (cameraMode == Game.CameraMode.SideBySide || cameraMode == Game.CameraMode.TwoStacked) { //Add a camera to each team SetupFollowCam(cameraConfig.cameraPrefabs[0], teams[0]); SetupFollowCam(cameraConfig.cameraPrefabs[1], teams[1]); } else if (cameraMode == Game.CameraMode.TwoByTwo) { Player[] tempPlayers = new Player[4] { teams[0].players[1], teams[0].players[0], teams[1].players[1], teams[1].players[0] }; for (int i = 0; i < cameraConfig.cameraPrefabs.Length; i++) { SetupFollowCam(cameraConfig.cameraPrefabs[i], tempPlayers[i]); } } else if (cameraMode == Game.CameraMode.Single) { //TODO add first camera prefab to current player? Debug.LogError("Unimplemented Camera Mode"); } //Spawn PiP UI SetupPipUI(cameraConfig.uiPrefab); } }
void Update() { m_lifetime -= Time.deltaTime; if (m_lifetime < 0) { //AudioManager.Instance.PlayDefaultMapMusic(); Owner.KartState.InvisibilityEquiped = null; for (int i = 0; i < Owner.transform.GetChild(0).childCount; i++) { Owner.transform.GetChild(0).GetChild(i).GetComponent <MeshRenderer>().enabled = true; } AudioManager.Instance.Play("out_invisibility"); CameraConfig.SetLayerRecursively(Owner.gameObject, Consts.Layer.Default); Destroy(gameObject); return; } }
private void land() { if (!groundedPreviousState && grounded && timeBtwLand <= 0) { if (playerClose) { SoundManager.PlaySound("land"); } effects.play("dustEffect", groundCheck.transform.position, Quaternion.identity, destroyTime); if (shakeCamera) { CameraConfig.shake(); } timeBtwLand = startTimeBtwLand; } timeBtwLand -= Time.deltaTime; }
public void LoadPlay(TimelineEventVM play, Image frame, FrameDrawing drawing, CameraConfig camConfig) { this.play = play; this.drawing = drawing; this.camConfig = camConfig; scaleFactor = (double)frame.Width / 500; blackboard.Background = frame; savetoprojectbutton.Visible = true; blackboard.Drawing = drawing; //FIXME: this needs to show a warning message? if (App.Current.LicenseLimitationsService.CanExecute(VASFeature.OpenZoom.ToString())) { blackboard.RegionOfInterest = drawing.RegionOfInterest; } UpdateLineWidth(); UpdateTextSize(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); CameraConfig cc = (CameraConfig)target; if (GUILayout.Button("save")) { cc.Save(); } //if (GUILayout.Button("clear")) { // cc.Clear(); //} if (GUILayout.Button("reload")) { cc.Load(); } }
public void LoadCameraConfigs() { LogHelper.WriteLog("Find Camera setting config"); string camera_json = LoadJson(this.camera_path); LogHelper.WriteLog(camera_json); CameraConfig items = JsonHelper.FromJSON <CameraConfig>(camera_json); try { LogHelper.WriteLog("Find " + items.Cameras.Count() + "cameras"); } catch { LogHelper.WriteLog("No camera info in setting file"); } this.cameras_config = items; }
public NormalPoseMotor(ECameraPoseMode modeId, CameraConfig config, HashSet <ECameraPoseMode> excludes, IMotorActive active ) { _modeId = (short)modeId; _motorType = SubCameraMotorType.Pose; this._excludes = new HashSet <short>(); foreach (var e in excludes) { this._excludes.Add((short)e); } _config = config.GetCameraConfigItem(modeId); _active = active; }
public Camera(CameraProfile profile, CameraConfig config, IVideoSource videoSource) { if (profile == null) { throw new ArgumentNullException("profile"); } if (config == null) { throw new ArgumentNullException("config"); } if (videoSource == null) { throw new ArgumentNullException("videoSource"); } _profile = profile; _config = config; _videoSource = videoSource; }
public override void ParseConfig(string xml) { XMLContent = xml; _config = XmlConfigParser <CameraConfig> .Load(xml); foreach (var cameraConfigItem in _config.PoseConfigs) { _cameraConfigItems[cameraConfigItem.CameraType] = cameraConfigItem; if (cameraConfigItem.Far < 100) { switch (cameraConfigItem.CameraType) { case ECameraConfigType.ThirdPerson: case ECameraConfigType.FirstPerson: case ECameraConfigType.DriveCar: case ECameraConfigType.Prone: case ECameraConfigType.Crouch: case ECameraConfigType.Swim: case ECameraConfigType.Rescue: case ECameraConfigType.Dying: case ECameraConfigType.Dead: cameraConfigItem.Far = 1500; break; case ECameraConfigType.AirPlane: case ECameraConfigType.Parachuting: case ECameraConfigType.ParachutingOpen: case ECameraConfigType.Gliding: cameraConfigItem.Far = 8000; break; default: throw new ArgumentOutOfRangeException(); } } if (Math.Abs(cameraConfigItem.Near) < 0.00001) { cameraConfigItem.Near = 0.03f; } } DefaultTranstionTime = _config.DefaultTransitionTime; }
/// <summary> /// Select the desired camera configuration. /// If high resolution toggle is checked, select the camera configuration /// with highest cpu image and highest FPS. /// If low resolution toggle is checked, select the camera configuration /// with lowest CPU image and highest FPS. /// </summary> /// <param name="supportedConfigurations">A list of all supported camera /// configuration.</param> /// <returns>The desired configuration index.</returns> private int _ChooseCameraConfiguration(List <CameraConfig> supportedConfigurations) { if (!m_Resolutioninitialized) { m_HighestResolutionConfigIndex = 0; m_LowestResolutionConfigIndex = 0; CameraConfig maximalConfig = supportedConfigurations[0]; CameraConfig minimalConfig = supportedConfigurations[0]; for (int index = 1; index < supportedConfigurations.Count; index++) { CameraConfig config = supportedConfigurations[index]; if ((config.ImageSize.x > maximalConfig.ImageSize.x && config.ImageSize.y > maximalConfig.ImageSize.y) || (config.ImageSize.x == maximalConfig.ImageSize.x && config.ImageSize.y == maximalConfig.ImageSize.y && config.MaxFPS > maximalConfig.MaxFPS)) { m_HighestResolutionConfigIndex = index; maximalConfig = config; } if ((config.ImageSize.x < minimalConfig.ImageSize.x && config.ImageSize.y < minimalConfig.ImageSize.y) || (config.ImageSize.x == minimalConfig.ImageSize.x && config.ImageSize.y == minimalConfig.ImageSize.y && config.MaxFPS > minimalConfig.MaxFPS)) { m_LowestResolutionConfigIndex = index; minimalConfig = config; } } m_Resolutioninitialized = true; } if (m_UseHighResCPUTexture) { return(m_HighestResolutionConfigIndex); } return(m_LowestResolutionConfigIndex); }
private void Capture_ImageGrabbed1(object sender, EventArgs e) { //Get the frame Bitmap frame = CameraConfig.GetFrame(stream); //Try catch block to successfuly terminate the thread try { //Pass each frame from the video capture to the output image this.Dispatcher.Invoke(() => { webcamOutput.Source = ImageUtils.ImageSourceFromBitmap(frame); }); } catch (System.Threading.Tasks.TaskCanceledException) { //End the thread if its exited early this.Dispatcher.InvokeShutdown(); } }
void Awake() { config = new CameraConfig(ConfigResourceLoader.inst.loadConfig("Config/camera.xml").ToXml()); cam = GetComponent <Camera>(); cam.fieldOfView = config.defaultFOV; fsm = new CameraFSM(this); fsm.changeState(GameState.Enter); LogicEvent.add("onBeginReplay", this, "onBeginReplay"); if (WithoutEnterShow_4Test_EditorOnly.instance != null) { fsm.changeState(GameState.Gaming); } else { fsm.changeState(GameState.Enter); } LogicEvent.add("onGameReady", this, "onGameReady"); LogicEvent.add("onGameOver", this, "onGameOver"); }
public void DrawingTool(Image image, TimelineEvent play, FrameDrawing drawing, CameraConfig camConfig, Project project) { DrawingTool dialog = new DrawingTool(mainWindow); dialog.TransientFor = mainWindow; Log.Information("Drawing tool"); if (play == null) { dialog.LoadFrame(image, project); } else { dialog.LoadPlay(play, image, drawing, camConfig, project); } dialog.Show(); dialog.Run(); dialog.Destroy(); }
public override void Init() { WindowProperties.Title = "Scan Face..."; WindowProperties.CanResize = false; _windowAdjusted = false; var cfg = CameraConfig.LoadConfig(); if (cfg == null) { ConfigureWebcam(); return; } _cc = new CameraController(); _cc.PropertyChanged += (s, e) => { if (e.PropertyName.Equals(nameof(_cc.ImageSource))) { WebcamImage = _cc.ImageSource; if (!_windowAdjusted && _cc.ImageSource != null) { var imageRatio = _cc.ImageSource.Width / _cc.ImageSource.Height; if (_cc.ImageSource.Height > _cc.ImageSource.Width) { WindowProperties.Height = 500; WindowProperties.Width = (int)(500 * imageRatio); } else { WindowProperties.Width = 400; WindowProperties.Height = (int)(400 * imageRatio); } _windowAdjusted = true; } } }; _cc.Start(cfg); }
public override void Initialize(bool backWard) { CameraConfig.SetLayerRecursively(Owner.gameObject, Consts.Layer.layer2d_j1 + Owner.PlayerIndex); AudioManager.Instance.Play("in_invisibility"); for (int i = 0; i < Owner.transform.GetChild(0).childCount; i++) { Owner.transform.GetChild(0).GetChild(i).GetComponent <MeshRenderer>().enabled = false; } if (Owner.KartState.InvisibilityEquiped != null) { Owner.KartState.InvisibilityEquiped.SetLifetime(); Destroy(gameObject); return; } transform.SetParent(Owner.transform); transform.localPosition = Vector3.zero; Owner.KartState.InvisibilityEquiped = this; SetLifetime(); }
public Camera CreateCamera(CameraProfile profile, CameraConfig config) { lock (_accessLock) { // 检查给定的源是否存在 if (profile.FilterType == FilterType.LocalCamera || profile.FilterType == FilterType.LocalDesktop) { if (!Locator.Get <IFilterManager>().IsFilterExist(profile.FilterType, profile.FilterId)) { throw new FilterNotFoundException(string.Format(CultureInfo.InvariantCulture, "Cannot find filter by type [{0}] and id [{1}].", profile.FilterType, profile.FilterId)); } } else if (profile.FilterType == FilterType.LocalAVIFile) { if (!File.Exists(profile.FilterId)) { throw new FilterNotFoundException(string.Format(CultureInfo.InvariantCulture, "Cannot find filter by type [{0}] and id [{1}].", profile.FilterType, profile.FilterId)); } } // 构造摄像机 Camera camera = _cameras.Find(c => c.Id == profile.Id); if (camera == null) { camera = CameraBuilder.Create(profile, config); _cameras.Add(camera); camera.Thumbnail = Locator.Get <IStreamingManager>().GetCameraSnapshot(camera.Id); Locator.Get <ICameraRepository>().Save(CameraBuilder.Translate(camera)); } return(camera); } }
// Use this for initialization void Awake() { if (instance == null) { instance = this; //DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); return; } splitScreen = MainMenu.splitScreen; if (splitScreen == true) { player2.gameObject.SetActive(true); Logger.Info("ScreenLayout GM: " + PlayerPrefs.GetInt("ScreenLayout", 1)); cameraConfig = (CameraConfig)PlayerPrefs.GetInt("ScreenLayout", 1); } else { player2.gameObject.SetActive(false); } //So that the game will never be paused if you go back to the main menu after opening the options menu Time.timeScale = 1; mapSeed = MainMenu.mapSeed; if (mapGenerator != null) { mapGenerator.GenerateGrid(); } int screenHeight = Screen.height; int screenWidth = Screen.width; }
public AutoTrackerDlg() { InitializeComponent(); CameraConfig cfg = new CameraConfig() { ROIs = new Point[] { new Point(0, 0) }, ROISize = new Point(800, 600) }; session = new ImaqSession("img0"); SetROIs(cfg); buflist = session.CreateBufferCollection(40); session.Acquisition.Configure(buflist); bufNum = 0; session.Acquisition.AcquireCompleted += Acquisition_AcquireCompleted; session.Acquisition.AcquireAsync(); session.Start(); }
internal static void ReloadCameras() { try { if (!Directory.Exists(configPath)) { Directory.CreateDirectory(configPath); } string[] files = Directory.GetFiles(configPath); if (!PluginConfig.Instance.ProfileLoadCopyMethod && Plugin.cameraController.currentProfile != null) { files = Directory.GetFiles(Path.Combine(profilePath, Plugin.cameraController.currentProfile)); } foreach (string filePath in files) { string fileName = Path.GetFileName(filePath); if (fileName.EndsWith(".json") && !Plugin.cameraController.Cameras.ContainsKey(fileName)) { Logger.log.Notice($"Found config {filePath}!"); CameraConfig Config = new CameraConfig(filePath); if (Config.configLoaded) { var cam = new GameObject($"CamPlus_{fileName}").AddComponent <CameraPlusBehaviour>(); Plugin.cameraController.Cameras.TryAdd(fileName, cam); cam.Init(Config); } } } } catch (Exception ex) { Logger.log.Error($"Exception while reloading cameras! Exception:" + $" {ex.Message}\n{ex.StackTrace}"); } }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); return; } transform = GetComponent <Transform>(); camera = GetComponent <Camera>(); if (config == null) { Debug.LogWarning("Config was not assigned for camera. Assigning default config."); config = ScriptableObject.CreateInstance <CameraConfig>(); } }
private int _ChooseCameraConfiguration(List <CameraConfig> supportedConfigurations) { if (!m_Resolutioninitialized) { string debug = "CameraConfig:\n"; m_HighestResolutionConfigIndex = 0; CameraConfig maximalConfig = supportedConfigurations[0]; for (int index = 1; index < supportedConfigurations.Count; index++) { CameraConfig config = supportedConfigurations[index]; debug += "config: size:" + config.ImageSize + " maxFPS:" + config.MaxFPS + " minFPS:" + config.MinFPS + " textureSize:" + config.TextureSize + " depthSensorUsage:" + config.DepthSensorUsage + "\n"; if ((config.ImageSize.x > maximalConfig.ImageSize.x && config.ImageSize.y > maximalConfig.ImageSize.y) || (config.ImageSize.x == maximalConfig.ImageSize.x && config.ImageSize.y == maximalConfig.ImageSize.y && config.MaxFPS > maximalConfig.MaxFPS)) { m_HighestResolutionConfigIndex = index; maximalConfig = config; } } m_Resolutioninitialized = true; { CameraConfig config = supportedConfigurations[m_HighestResolutionConfigIndex]; string info = "Config #" + m_HighestResolutionConfigIndex + "config: size:" + config.ImageSize + " maxFPS:" + config.MaxFPS + " minFPS:" + config.MinFPS + " textureSize:" + config.TextureSize + " depthSensorUsage:" + config.DepthSensorUsage; Utils.Toast(info); Utils.Log(info); } } return(m_HighestResolutionConfigIndex); }
internal static CameraConfigData Translate(CameraConfig config) { CameraConfigData data = new CameraConfigData() { FriendlyName = config.FriendlyName, OriginalSourceString = config.OriginalSourceString, SourceString = config.SourceString, FrameInterval = config.FrameInterval, FrameRate = config.FrameRate, UserName = config.UserName, Password = config.Password, UserAgent = config.UserAgent, }; if (config.Resolution != null) { data.Resolution = new ResolutionData() { Width = config.Resolution.Width, Height = config.Resolution.Height }; } return(data); }
public async Task ProcessImageAsync(CameraConfig camera, Image image, CancellationToken cancellationToken) { _logger.LogDebug( "Image at {imagePath} was created and matched to camera {camera}", image.FullPath, camera.Name); if (camera.TelegramTrigger.IsInCooldown(image) && camera.Triggers.All(t => t.IsInCooldown(image))) { _logger.LogDebug( "All triggers are in cooldown for camera {camera}, ignoring image at {imagePath}", camera.Name, image.FullPath ); } else { var response = await _deepStackService.DetectAsync(image.FullPath, cancellationToken); await response .Right(async r => await ProcessDeepStackResponseAsync(camera, r, image, cancellationToken)) .Left(async error => await Task.Run(() => _logger.LogWarning(error.Message), cancellationToken)); } }
internal static CameraConfig Translate(CameraConfigData data) { CameraConfig config = new CameraConfig() { FriendlyName = data.FriendlyName, OriginalSourceString = data.OriginalSourceString, SourceString = data.SourceString, FrameInterval = data.FrameInterval, FrameRate = data.FrameRate, UserName = data.UserName, Password = data.Password, UserAgent = data.UserAgent, }; if (data.Resolution != null) { config.Resolution = new Resolution() { Width = data.Resolution.Width, Height = data.Resolution.Height }; } return(config); }
public Ffmpeg(ILogger <Ffmpeg> logger, Data.CameraConfig cameraConfig) { _logger = logger; _cameraConfig = cameraConfig; }
public void EmitDrawFrame(TimelineEvent play, int drawingIndex, CameraConfig camConfig, bool current) { if (DrawFrame != null) { DrawFrame (play, drawingIndex, camConfig, current); } }
public void LoadPlay(TimelineEvent play, Image frame, FrameDrawing drawing, CameraConfig camConfig, Project project) { this.play = play; this.drawing = drawing; this.project = project; this.camConfig = camConfig; scaleFactor = (double)frame.Width / 500; blackboard.Background = frame; savetoprojectbutton.Visible = true; blackboard.Drawing = drawing; blackboard.RegionOfInterest = drawing.RegionOfInterest; }
void HandleDrawFrame(TimelineEvent play, int drawingIndex, CameraConfig camConfig, bool current) { Image pixbuf; FrameDrawing drawing = null; Time pos; player.Pause (); if (play == null) { play = loadedPlay; } if (play != null) { if (drawingIndex == -1) { drawing = new FrameDrawing { Render = player.CurrentTime, CameraConfig = camConfig, RegionOfInterest = camConfig.RegionOfInterest.Clone (), }; } else { drawing = play.Drawings [drawingIndex]; } pos = drawing.Render; } else { pos = player.CurrentTime; } if (framesCapturer != null && !current) { // FIXME Time offset = openedProject.Description.FileSet.First ().Offset; pixbuf = framesCapturer.GetFrame (pos + offset, true, -1, -1); } else { pixbuf = player.CurrentFrame; } if (pixbuf == null) { guiToolkit.ErrorMessage (Catalog.GetString ("Error capturing video frame")); } else { guiToolkit.DrawingTool (pixbuf, play, drawing, camConfig, openedProject); } }