public void DetectBlobsNone() { // no blob string[] inGrid = { "XXXXXX", "XXXXXX", "XXXXXX", "XXXXXX", }; string[] outGrid = { "@@@@@@", "@@@@@@", "@@@@@@", "@@@@@@", }; bool[][] map = GridTest.InitBoolGrid(inGrid); int[][] blob = GridTest.InitIntGrid(outGrid); List<BlobMap.Blob> compareBlobs = new List<BlobMap.Blob>(); bool LocTest(Loc loc) => map[loc.X][loc.Y]; BlobMap result = Detection.DetectBlobs(new Rect(0, 0, map.Length, map[0].Length), LocTest); Assert.That(result.Map, Is.EqualTo(blob)); Assert.That(result.Blobs, Is.EqualTo(compareBlobs)); }
// Use this for initialization void Start() { goal = destinationPoints[0].position; agent = GetComponent <NavMeshAgent>(); playerDetection = GameObject.FindGameObjectWithTag("Player").GetComponent <Detection>(); }
public Stimulus(int p, Detection d, GameObject g, Action a) { priority = p; type =d; target = g; action =a; }
public async Task InsertDetection(InsertDetection detection) { Response.IsSuccessful = true; // validate request values if (detection.WeatherId == 0 || detection.CameraId == 0) { Response.IsSuccessful = false; Response.ErrorMessage = "You Must provide WeatherId CameraId "; return; } Detection newDetection = new Detection() { DetectionId = 0, WeatherId = detection.WeatherId, CameraId = detection.CameraId, Date = DateTime.UtcNow, ImagePath = detection.ImagePath }; // insert detection if (!await detectionCRUDService.InsertDetection(newDetection)) { Response.IsSuccessful = false; Response.ErrorMessage = "Cannot Insert Detecion "; return; } }
private void SettingDetectionList(UrlScan urlScan) { Task <List <Detection> > .Factory.StartNew(() => { ShowProcess(true); List <Detection> detections = new List <Detection>(); PropertyInfo[] propertyInfos = urlScan.scans.GetType().GetProperties(); foreach (PropertyInfo propertyInfo in propertyInfos) { if (propertyInfo.GetValue(urlScan.scans, null) is IUrlScanInfo fileScanInfo) { string engine = propertyInfo.Name; bool detected = fileScanInfo.detected; string result = fileScanInfo.result?.ToString(); detections.Add(Detection.CreateDetection(engine, detected, string.Empty, result, string.Empty)); } } return(detections); }).ContinueWith(e => { DetectionListView.SetObjects(e.Result); ShowProcess(false); }); }
/// <summary> /// 关闭检查线程 /// </summary> public void CloseThread() { // 关闭记录 OperateLog.Instance.RecordAll(); //关闭查KEY(可能会导致异常:Detection.Stop();在创建窗口句柄之前,不能在控件上调用 Invoke 或 BeginInvoke。 try { Detection.Stop(); } catch { } //关闭线程 if (null != Resources.GetRes().handleThread) { Resources.GetRes().handleThread.Abort(); Resources.GetRes().handleThread = null; } //关闭锁 if (Key.GetKeys().Check()) { Key.GetKeys().Close(); } }
// Start is called before the first frame update void Start() { obj = GameObject.Find("Ball_Detection"); Script = obj.GetComponent <Detection>(); Debug.Log(Script.GetInstanceID()); //anotherScript = GetComponentInParent<Detection>(); //int i = anotherScript.CreateNum[0]; //if (this.name == ("Cube_Detection(14)")) //{ // this.Num = 0; //} //else if(this.name == ("Cube_Detection(0)")) //{ // this.Num = 5; //} //else //{ // this.Num = 1; //} //this.Num = SetNum(Script.Num); //this.Num = SetNum(Script.Num); //this.Num = SetNum(Script.Num); ////this.Num = Script.Num1; //Debug.Log(Script.Num1); }
public async Task PredictNoResize() { // Arrange using var bmp = new Bitmap(_imageFile); // Act await _dut.Start(_host, _modelName, _labelFile).ConfigureAwait(false); IEnumerable <Detection> detections = await _dut.Predict(bmp).ConfigureAwait(false); await _dut.Disconnect().ConfigureAwait(false); Detection[] results = detections.ToArray(); LogDetections(detections); // Assert Assert.AreEqual(50, results.Length); Detection result = results[0]; Assert.AreEqual("person", result.Label); Assert.AreEqual(0.87890625, result.Score); Assert.AreEqual("{X=0,013600767,Y=0,004936278,Width=0,98389876,Height=0,98389876}", result.Box.ToString()); result = results[1]; Assert.AreEqual("tie", result.Label); Assert.AreEqual(0.5, result.Score); Logger.LogMessage("{0}", result.Box.ToString()); Assert.AreEqual("{X=0,43098423,Y=0,7059594,Width=0,13439634,Height=0,20436776}", result.Box.ToString()); }
public List <LanguagesInfo> GetDetectedLanguages(Detection detection) { var list = new List <LanguagesInfo>(); list.Add(new LanguagesInfo() { language = "English", confidence = ConfidenceOfLanguage(detection, "en") }); list.Add(new LanguagesInfo() { language = "Spanish", confidence = ConfidenceOfLanguage(detection, "es") }); list.Add(new LanguagesInfo() { language = "Portuguese", confidence = ConfidenceOfLanguage(detection, "pt") }); list.Add(new LanguagesInfo() { language = "Bulgarian", confidence = ConfidenceOfLanguage(detection, "bg") }); list.Add(new LanguagesInfo() { language = "Russian", confidence = ConfidenceOfLanguage(detection, "ru") }); return(list); }
public void SetUp() { log = new Logging(); writer = Substitute.For <IWriter>(); _uut = new Compare(); detection = new Detection(_uut, log, writer); Track t1 = new Track(); t1.Tag = "ABC"; t1.XCoor = 50000; t1.YCoor = 50000; t1.Altitude = 4000; t1.Timestamp = new DateTime(2017, 04, 23, 12, 18, 30, 123); Track t2 = new Track(); t2.Tag = "DEF"; t2.XCoor = 55000; t2.YCoor = 50000; t2.Altitude = 4300; liste = new List <Track>(); liste.Add(t1); liste.Add(t2); File.WriteAllText("logfile.txt", string.Empty); }
public async Task PredictResize() { // Arrange using var bmp = new Bitmap(_largeImageFile); // Act await _dut.Start(_host, _modelName, _labelFile).ConfigureAwait(false); IEnumerable <Detection> detections = await _dut.Predict(bmp).ConfigureAwait(false); await _dut.Disconnect().ConfigureAwait(false); Detection[] results = detections.ToArray(); LogDetections(detections); // Assert Assert.AreEqual(50, results.Length); Detection result = results[0]; Assert.AreEqual("person", result.Label); Assert.AreEqual(0.83984375, result.Score, 0.0001); Assert.AreEqual("{X=0,009679586,Y=0,027399272,Width=0,9744122,Height=0,95677316}", result.Box.ToString()); result = results[1]; Assert.AreEqual("tie", result.Label); Assert.AreEqual(0.5, result.Score, 0.0001); Logger.LogMessage("{0}", result.Box.ToString()); Assert.AreEqual("{X=0,43220064,Y=0,7078091,Width=0,13196346,Height=0,20066833}", result.Box.ToString()); }
public async Task <int> CreateRequest(NewRequest request) { try { var newDetection = new Detection { Name = request.Name, StatusId = 1, Image = request.Files.Select(x => new ImageAttachment() { Name = x.FileName, ImageAttachmentTypeId = ImageTypes.Detection }).FirstOrDefault() }; detectionRepository.Add(newDetection); detectionRepository.Save(); await filesService.Upload(request.Files, $"{nameof(ImageTypes.Detection)}/{newDetection.Id}"); return(newDetection.Id); } catch (Exception ex) { logger.LogError(ex, "Exception when creating face deteciton request "); throw new Exception("Exception when creating face deteciton request "); } }
void Start() { m_player = GameObject.FindGameObjectWithTag("Player"); m_detection = GetComponent <Detection>(); m_degreesPerSecond = (m_maxRotationAngle) / ((m_timeForFullRotation / 2f) - (m_timeStandingStill)); m_timeForHalfRotation = (m_timeForFullRotation / 2f) - (m_timeStandingStill); }
public bool CheckMessageIsCorrectLanguage(string completeTextString) { RestClient client = new RestClient("http://ws.detectlanguage.com"); RestRequest request = new RestRequest("/0.2/detect", Method.POST); request.AddParameter("key", ConfigurationManager.AppSettings["DetectLanguageApiKey"]); request.AddParameter("q", completeTextString); IRestResponse response = client.Execute(request); JsonDeserializer deserializer = new JsonDeserializer(); try { Result result = deserializer.Deserialize <Result>(response); Detection detection = result?.data?.detections.FirstOrDefault(); if (detection == null) { return(true); } return(detection.confidence < 10 || detection.language == _resourceCulture.TwoLetterISOLanguageName); } catch { return(true); } }
// insert detection query public async Task<bool> InsertDetection(Detection detection) { DynamicParameters _params = new DynamicParameters(); _params.Add("@WeatherId", detection.WeatherId); _params.Add("@CameraId", detection.CameraId); _params.Add("@ImagePath", detection.ImagePath); _params.Add("@Date", detection.Date); string sql = " INSERT INTO " + bods.bods.Tdetection + " (" + bods.bods.Tdetection.FWeatherId.Cn + " ," + bods.bods.Tdetection.FCameraId.Cn + " ," + bods.bods.Tdetection.FImagePath.Cn + " ," + bods.bods.Tdetection.FDate.Cn + ")" + " VALUES" + " (@WeatherId" + " ,@CameraId" + " ,@ImagePath" + " ,@Date" + ");"; using (IDbConnection conn = DataLayer.NewConnection()) { return Convert.ToBoolean(await conn.ExecuteAsync(sql, _params)); } }
public float ConfidenceOfLanguage(Detection detection, string language) { switch (detection.Language) { case "en": { return(language == "en" ? detection.Confidence * 100 : 0); } case "es": { return(language == "es" ? detection.Confidence * 100 : 0); } case "pt": { return(language == "pt" ? detection.Confidence * 100 : 0); } case "ru": { return(language == "ru" ? detection.Confidence * 100 : 0); } case "bg": { return(language == "bg" ? detection.Confidence * 100 : 0); } default: { return(0); } } }
public void DetectBlobsSingle() { // single blob string[] inGrid = { "XXXXXX", "X..XXX", "X....X", "X.XXXX", "XXXXXX", }; string[] outGrid = { "@@@@@@", "@AA@@@", "@AAAA@", "@A@@@@", "@@@@@@", }; bool[][] map = GridTest.InitBoolGrid(inGrid); int[][] blob = GridTest.InitIntGrid(outGrid); var compareBlobs = new List<BlobMap.Blob> { new BlobMap.Blob(new Rect(1, 1, 4, 3), 7) }; bool LocTest(Loc loc) => map[loc.X][loc.Y]; BlobMap result = Detection.DetectBlobs(new Rect(0, 0, map.Length, map[0].Length), LocTest); Assert.That(result.Map, Is.EqualTo(blob)); Assert.That(result.Blobs, Is.EqualTo(compareBlobs)); }
public SystemService(SettingsStorage Settings, DetectionsHistory Detections, LogsHistory Logs) { _settings = Settings; _detections = Detections; _logs = Logs; Task.Run(() => { WslCoreWrapper.FilterPortWrapper filterPortWrapper = new WslCoreWrapper.FilterPortWrapper(); try { while (true) { Console.WriteLine("wait detection"); var name = filterPortWrapper.WaitDetection(); Console.WriteLine("detected"); var det = new Detection(name, DetectionResolutionType.Killed); _callback.OnDetection(det); _detections.Add(det); } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.ToString()); } }); }
private void Awake() { navMeshAgent = GetComponentInChildren <NavMeshAgent>(); aggroDetection = GetComponent <Detection>(); aggroDetection.onAggro += AggroDetection_onAggro; anim = GetComponentInChildren <Animator>(); }
public PoseTrackingValue(Detection poseDetection, NormalizedLandmarkList poseLandmarks, LandmarkList poseWorldLandmarks, NormalizedRect roiFromLandmarks) { this.poseDetection = poseDetection; this.poseLandmarks = poseLandmarks; this.poseWorldLandmarks = poseWorldLandmarks; this.roiFromLandmarks = roiFromLandmarks; }
public override void Apply(T map) { Grid.LocTest checkGround = (Loc testLoc) => { if (!Collision.InBounds(map.Width, map.Height, testLoc)) { return(false); } return(map.Tiles[testLoc.X][testLoc.Y].TileEquivalent(map.RoomTerrain) && !map.HasTileEffect(testLoc)); }; Grid.LocTest checkBlock = (Loc testLoc) => { if (!Collision.InBounds(map.Width, map.Height, testLoc)) { return(false); } return(map.Tiles[testLoc.X][testLoc.Y].TileEquivalent(map.WallTerrain)); }; List <LocRay4> rays = Detection.DetectWalls(((IViewPlaceableGenContext <MapGenEntrance>)map).GetLoc(0), new Rect(0, 0, map.Width, map.Height), checkBlock, checkGround); EffectTile effect = new EffectTile(LockedTile, true); TileListState state = new TileListState(); effect.TileStates.Set(state); List <Loc> freeTiles = new List <Loc>(); LocRay4? ray = PlaceRoom(map, rays, effect, freeTiles); if (ray != null) { PlaceEntities(map, freeTiles); } }
public void DetectBlobsCorners() { // diagonal attached blobs string[] inGrid = { "..XX..", "..XX..", "XXXXXX", "XXXXXX", }; string[] outGrid = { "AA@@BB", "AA@@BB", "@@@@@@", "@@@@@@", }; bool[][] map = GridTest.InitBoolGrid(inGrid); int[][] blob = GridTest.InitIntGrid(outGrid); var compareBlobs = new List<BlobMap.Blob> { new BlobMap.Blob(new Rect(0, 0, 2, 2), 4), new BlobMap.Blob(new Rect(4, 0, 2, 2), 4), }; bool LocTest(Loc loc) => map[loc.X][loc.Y]; BlobMap result = Detection.DetectBlobs(new Rect(0, 0, map.Length, map[0].Length), LocTest); Assert.That(result.Map, Is.EqualTo(blob)); Assert.That(result.Blobs, Is.EqualTo(compareBlobs)); }
public IResponse <string> TranslateText(string text, string toLanguage = "en") { if (string.IsNullOrWhiteSpace(text)) { return(GetResponse(true, "")); } try { Detection detection = client.DetectLanguage(text); var response = client.TranslateText( text: text, targetLanguage: toLanguage, sourceLanguage: detection.Language); return(GetResponse(true, response.TranslatedText)); } catch (HttpRequestException ex) { _logger.Log(LogCategory.Error, ex); return(GetResponse(false, null)); } catch (TaskCanceledException ex) { _logger.Log(LogCategory.Error, ex); return(GetResponse(false, null)); } catch (Exception ex) { _logger.Log(LogCategory.Error, ex); return(GetResponse(false, null)); } }
public void DetectDisconnectSome() { // disconnect string[] inGrid = { "XXXXXX", "X....X", "X....X", "XXXXXX", }; string[] blobGrid = { "..", "..", }; bool[][] map = GridTest.InitBoolGrid(inGrid); bool[][] blob = GridTest.InitBoolGrid(blobGrid); bool LocTest(Loc loc) => map[loc.X][loc.Y]; bool BlobTest(Loc loc) => blob[loc.X][loc.Y]; bool result = Detection.DetectDisconnect(new Rect(0, 0, map.Length, map[0].Length), LocTest, new Loc(2, 1), new Loc(blob.Length, blob[0].Length), BlobTest, false); Assert.That(result, Is.EqualTo(true)); }
// Use this for initialization private void Start() { globalMovement = GameObject.Find("GlobalStateMachine").GetComponent <GlobalSquadMovement>(); agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); detection = GetComponentInChildren <Detection>(); _SM = GetComponent <StateMachine>(); }
public void DetectDisconnectErasureTolerant() { // total erasure (with tolerance) string[] inGrid = { "XXXXXX", "X....X", "X....X", "XXXXXX", }; string[] blobGrid = { "....", "....", }; bool[][] map = GridTest.InitBoolGrid(inGrid); bool[][] blob = GridTest.InitBoolGrid(blobGrid); bool LocTest(Loc loc) => map[loc.X][loc.Y]; bool BlobTest(Loc loc) => blob[loc.X][loc.Y]; bool result = Detection.DetectDisconnect(new Rect(0, 0, map.Length, map[0].Length), LocTest, Loc.One, new Loc(blob.Length, blob[0].Length), BlobTest, false); Assert.That(result, Is.EqualTo(false)); }
private void Capture_ImageGrabbed(object sender, EventArgs e) { Mat currentFrame = new Mat(); _capture.Retrieve(currentFrame); Detection[] detections = new Detection[0]; if (currentFrame != null && _detector != null) { using (System.Drawing.Bitmap bitmap = currentFrame.Clone().Bitmap) { detections = _detector.DetectOnImage(bitmap); } } Dispatcher.Invoke(() => { var image = currentFrame.ToImage <Emgu.CV.Structure.Bgr, byte>(); using (image) { if (detections.Count() > 0) { foreach (var detection in detections) { image.Draw(String.Format("id{0}, {1}%", detection.obj_id, (int)(detection.prob * 100)), new System.Drawing.Point(detection.x, detection.y), FontFace.HersheySimplex, 0.9, new Emgu.CV.Structure.Bgr(System.Drawing.Color.Blue), 2); image.Draw(new System.Drawing.Rectangle((int)detection.x, (int)detection.y - 20, (int)detection.w, (int)detection.h + 20), new Emgu.CV.Structure.Bgr(System.Drawing.Color.Blue), 2); } } _image.Source = ToBitmapSource(image); } }); }
public void FindAllRectsFractal() { // fractal rect string[] inGrid = { ".XX.XX.XX.", ".XXXXXXXX.", "..XXXXXX..", ".XXXXXXXX.", ".XXXXXXXX.", "..XXXXXX..", ".XXXXXXXX.", ".XX.XX.XX.", }; bool[][] map = InitGrid(inGrid); List<Rect> result = Detection.FindAllRects(map); var compare = new List<Rect> { new Rect(2, 0, 1, 8), new Rect(1, 0, 2, 2), new Rect(4, 0, 2, 8), new Rect(7, 0, 1, 8), new Rect(7, 0, 2, 2), new Rect(2, 1, 6, 6), new Rect(1, 1, 8, 1), new Rect(1, 3, 8, 2), new Rect(1, 6, 2, 2), new Rect(7, 6, 2, 2), new Rect(1, 6, 8, 1), }; Assert.That(result, Is.EqualTo(compare)); }
public async void Run([QueueTrigger("collarini-vendrame-queue", Connection = "ITS_Storage")] string myQueueItem, ILogger log) { log.LogInformation($"C# Queue trigger function processed: {myQueueItem}"); if (myQueueItem != null) { string messageTxt = myQueueItem; var detectionDeserialize = JsonSerializer.Deserialize <Detection>(messageTxt); //azure table storage var detectionEntity = new DetectionEntity(Guid.NewGuid(), detectionDeserialize.ScooterId, detectionDeserialize.SensorId, detectionDeserialize.SensorValue, detectionDeserialize.SensorType, detectionDeserialize.SensorDetectionDate ); _detectionRepository.insertDetection(_detectionTable, detectionEntity); //influxdb storage var detectionInflux = new Detection { ScooterId = detectionDeserialize.ScooterId, SensorId = detectionDeserialize.SensorId, SensorValue = detectionDeserialize.SensorValue, SensorType = detectionDeserialize.SensorType, SensorDetectionDate = detectionDeserialize.SensorDetectionDate }; _influxRepository.insertDetection(detectionInflux, _influxDBClient, bucket, org); } }
//Methode permettant d'identifier l'etudiant public static string getIdEtudiant(Bitmap croppedCopiePage1, int seuilRemplissage, int nuancesGrisAdmise) { Rectangle zoneAnalyse = new Rectangle(290, 500, 40, 40); float pourcentageNoirCase; string retour = ""; for (int x = 0; x < 7; x++) { for (int i = 0; i < 9; i++) { pourcentageNoirCase = Detection.getNbPixelsNoirs(croppedCopiePage1, zoneAnalyse, nuancesGrisAdmise); if (pourcentageNoirCase >= seuilRemplissage) { retour += i; break; } zoneAnalyse.Y += 60; } zoneAnalyse.Y = 500; zoneAnalyse.X += 80; } return(retour); }
// unity start void Start() { // clone materials m_ring.material = new Material(m_ring.material); m_sweep.material = new Material(m_sweep.material); foreach (var blip in m_blips) { blip.material = new Material(blip.material); } // start sweep angle at zero m_sweepAngle = 0.0f; // allocate detection list m_detectionList = new Detection[m_blips.Length]; for (var i = 0; i < m_detectionList.Length; i++) { m_detectionList[i] = new Detection(m_blips[i]); } // make everything invisible Show(); }
public void newStimulus(int priority, Detection detect, Action act, GameObject target = null) { //if (target != null) //{ // Debug.Log(target.transform.position); //} stims.Add(new Stimulus(priority,detect,target, act)); orderStims(); }