public void RespectSettingsChange() { var image = new Image <Gray, byte>(10, 10); for (var i = 0; i < image.Width; i++) { for (var j = 0; j < image.Height; j++) { image[i, j] = new Gray(255); } } var detector = new PeopleDetector(DetectionSettings.Default, logger.Object); detector.OnNext(image); Assert.True(detector.PeopleDetected); detector.Settings = new DetectionSettings(1.1); detector.Reset(); detector.OnNext(image); Assert.False(detector.PeopleDetected); }
public void Run(PeopleDetector peoDtc, Sheet sheet, int sequenceIdx) { SetInputInitDepthData(sheet, sequenceIdx); SetInputCameraAngle(sheet, sequenceIdx); SetInputPeopleNumberMax(sheet, sequenceIdx); SetInputDepthData(sheet, sequenceIdx); result = peoDtc.Execute(inputInitDepthData, inputCameraAngle, inputPeopleNumberMax, inputDepthData); sheet.writeStr(sequenceIdx, 9, result.ToString()); }
public void SetMaskToNullOnReset() { var detector = new PeopleDetector(new DetectionSettings(1), logger.Object); detector.OnNext(new Image <Gray, byte>(1, 1)); detector.Reset(); Assert.Null(detector.Mask); }
public void SetMaskToNullWhenStreamErrorsOut() { var detector = new PeopleDetector(new DetectionSettings(1), logger.Object); detector.OnNext(new Image <Gray, byte>(1, 1)); detector.OnError(new System.Exception()); Assert.Null(detector.Mask); }
public void SetMaskToNullWhenStreamEnds() { var detector = new PeopleDetector(new DetectionSettings(1), logger.Object); detector.OnNext(new Image <Gray, byte>(1, 1)); detector.OnCompleted(); Assert.Null(detector.Mask); }
public void NotifyWhenPeopleNotDetected() { var propertiesChanged = new List <string>(); var detector = new PeopleDetector(new DetectionSettings(1), logger.Object); detector.PropertyChanged += (_, e) => propertiesChanged.Add(e.PropertyName); detector.OnNext(new Image <Gray, byte>(1, 1)); Assert.Contains(propertiesChanged, s => nameof(IPeopleDetector.PeopleDetected).Equals(s)); }
public void Run(PeopleDetector peoDtc, Sheet sheet, int sequenceIdx) { outputGetGroundCloud = new List <TFL_PointXYZ>(); result = peoDtc.GetGroundCloud(outputGetGroundCloud); sheet.writeStr(sequenceIdx, 11, result.ToString()); // Result is wrote to xls PLYfileNamePosfix = PLYfileNamePosfix + 1; PLYfileName = Constants.OUTPUT_GET_GROUND_CLOUD_DIR + "outputGround_" + PLYfileNamePosfix.ToString() + ".ply"; TFL_Utilities.SavePLY(outputGetGroundCloud.ToArray(), (ulong)outputGetGroundCloud.Count(), PLYfileName); // output groud is saved as PLY sheet.writeStr(sequenceIdx, 10, "outputGround_" + PLYfileNamePosfix.ToString() + ".ply"); // PLY filename is wrote to xls }
public void NotDetectPresenceIfMaskIsBlack() { var image = new Image <Gray, byte>(10, 10); for (var i = 0; i < image.Width; i++) { for (var j = 0; j < image.Height; j++) { image[i, j] = new Gray(0); } } var detector = new PeopleDetector(DetectionSettings.Default, logger.Object); detector.OnNext(image); Assert.False(detector.PeopleDetected); }
public void Run(PeopleDetector peoDtc, Sheet sheet, int sequenceIdx) { outputGetPeopleData = new List <TFL_Human>(); result = peoDtc.GetPeopleData(outputGetPeopleData); sheet.writeStr(sequenceIdx, 13, result.ToString()); // Result is wrote to xls PLYfileNamePosfix = PLYfileNamePosfix + 1; string xlsStr = ""; int numPeo = outputGetPeopleData.Count(); for (int i = 0; i < numPeo; i++) { PLYfileName = PLYfileNamePosfix.ToString() + "_person" + i.ToString() + ".ply"; TFL_Utilities.SavePLY(outputGetPeopleData[i].peoplePointCloud.ToArray(), (ulong)outputGetPeopleData[i].peoplePointCloud.Count(), Constants.OUTPUT_GET_PEOPLE_DATA_DIR + PLYfileName); // output people is saved as PLY xlsStr = xlsStr + PLYfileName + ";"; } sheet.writeStr(sequenceIdx, 12, xlsStr); // PLY filename is wrote to xls }
static void Main(string[] args) { try { // Read config List <string> configStrLst = new List <string>(new string[] { "element1", "element2", "element3" }); try { System.IO.StreamReader file = new System.IO.StreamReader(Constants.TEST_CONFIG_DIR); string line; int cnt = 0; while ((line = file.ReadLine()) != null) { //System.Console.WriteLine(line); configStrLst[cnt] = line; cnt++; } } catch (System.Exception e) { Console.WriteLine(e); Console.WriteLine("TEST CONFIG NOT FOUND"); Console.WriteLine(Constants.TEST_CONFIG_DIR); return; } int caseStart = 1; int caseEnd = 3; caseStart = Int16.Parse(configStrLst[1]); caseEnd = Int16.Parse(configStrLst[2]); string tstPlanDir = Constants.TESTPLAN_DIR + configStrLst[0]; Book book = new BinBook(); PeopleDetector peoDtc = new PeopleDetector(); ExcuteTest exTst = new ExcuteTest(); GetGroundCloudTst gndTst = new GetGroundCloudTst(caseStart); GetPeopleDataTst peoTst = new GetPeopleDataTst(caseStart); if (book.load(tstPlanDir)) { Console.WriteLine("Testplan file name: " + configStrLst[0]); Console.WriteLine("Start from case number: " + configStrLst[1]); Console.WriteLine("End at case number: " + configStrLst[2]); Sheet sheet = book.getSheet(0); /* Parse the sequences */ int tstCaseCnt = 0; int sequenceIdx = 10; double sequenceNum = sheet.readNum(sequenceIdx, 4); while (true) { switch (sequenceNum) { case 1: // Run function 1 if (tstCaseCnt >= caseStart) { exTst.Run(peoDtc, sheet, sequenceIdx); book.save(Constants.TEST_RESULT_DIR); } break; case 2: // Run function 2 if (tstCaseCnt >= caseStart) { gndTst.Run(peoDtc, sheet, sequenceIdx); book.save(Constants.TEST_RESULT_DIR); } break; case 3: // Run function 3 if (tstCaseCnt >= caseStart) { peoTst.Run(peoDtc, sheet, sequenceIdx); book.save(Constants.TEST_RESULT_DIR); } break; case -1: // Start testcase tstCaseCnt = tstCaseCnt + 1; if (tstCaseCnt > caseEnd) { goto ENDTEST; } else if (tstCaseCnt >= caseStart) { System.Console.WriteLine("Start testcase number " + tstCaseCnt); } break; case -2: // End testcase if (tstCaseCnt >= caseStart) { System.Console.WriteLine("End testcase number " + tstCaseCnt); } break; case -3: // Stop goto ENDTEST; default: // Invalid return; } //Console.WriteLine(sequenceNum); sequenceIdx = sequenceIdx + 1; sequenceNum = sheet.readNum(sequenceIdx, 4); } ENDTEST: Console.WriteLine("END TEST"); } else { Console.WriteLine("TESTPLAN_DIR NOT FOUND"); Console.WriteLine(tstPlanDir); } } catch (System.Exception e) { Console.WriteLine(e.Message); } }