protected override TestImage CreateTestImage(bool isReferenceImg = true)
        {
            var utils = new ImageTestUtils();

            var(rect, face) = utils.GetFaceImg("front");
            var user = UserTestUtils.CreateTestUser(1);

            return(new TestImage(FaceEncodings, rect, face, HeadRotation.Front, DateTime.UtcNow, isReferenceImg, user.UserId));
        }
        static SqliteTestImageRepositoryTests()
        {
            var utils = new ImageTestUtils();

            var(rect, face) = utils.GetFaceImg("front");

            SharedFaceRecognitionModel.Init(new ConfigurationService(""));
            FaceEncodings = new DnFaceRecognition().GetFaceEncodings(face);
        }
Пример #3
0
        public void TestImage_to_DbTestImage()
        {
            var utils = new ImageTestUtils();

            var(rect, face) = utils.GetFaceImg("front");

            var encodings = new DnFaceRecognition().GetFaceEncodings(face);

            var now       = DateTime.UtcNow;
            var testImg   = new TestImage(encodings, new Rect(0, 1, 20, 21), Mat.Zeros(4, 4, MatType.CV_8UC1), HeadRotation.Left, now, true, UserTestUtils.CreateTestUser(1).UserId);
            var dbTestImg = _mapper.Map <DbTestImage>(testImg);

            dbTestImg.Img.Should().NotBeEmpty();
            dbTestImg.FaceEncoding.Should().NotBeEmpty();
            dbTestImg.FaceLocation_x.Should().Be(0);
            dbTestImg.FaceLocation_y.Should().Be(1);
            dbTestImg.FaceLocation_width.Should().Be(20);
            dbTestImg.FaceLocation_height.Should().Be(21);
            dbTestImg.DateCreated.Should().Be(now);
            dbTestImg.IsReferenceImg.Should().BeTrue();
            dbTestImg.HorizontalHeadRotation.Should().Be((int)HeadRotation.Left);
            dbTestImg.Id.Should().BeNull();
            dbTestImg.UserId.Should().Be(1);
        }