Exemplo n.º 1
0
        /*
         *
         *          VoxelLogic.WriteVOX(folder + moniker + "_palette" + palette + "_" + i + ".vox",
         *              TransformLogic.FillInterior(
         *                      //TransformLogic.RunSurfaceCA(
         *                      TransformLogic.RunCA(
         *                          FaceLogic.FaceArrayToByteArray(
         *                              //FaceLogic.DoubleSize(
         *                              FaceLogic.GetFaces(
         *                                      TransformLogic.RunThinningCA(
         *                                          posed[(int)(frames[i][0])]
         *                                          .Interpolate(posed[(int)(frames[i][1])], frames[i][2])
         *                                          .Translate(10 * OrthoSingle.multiplier, 10 * OrthoSingle.multiplier, 0, (alt) ? "Left_Lower_Leg" : "Left_Leg")
         *                                          .Finalize(),
         *                                      2, true)//1 + OrthoSingle.multiplier * OrthoSingle.bonus / 2)
         *                                  )
         *
         *                          ),
         *                      2, true)
         *              ),
         *              "W", palette);
         */
        public static byte[,,] Scale(MagicaVoxelData[] voxels)
        {
            return(TransformLogic.FillInterior(
                       FaceLogic.FaceArrayToByteArray(
                           FaceLogic.DoubleSize(
                               FaceLogic.GetFaces(voxels, PaletteDraw.sizex, PaletteDraw.sizey, PaletteDraw.sizez)
                               )
                           )
                       ));

            /*
             *
             * return TransformLogic.FillInterior(
             *                  //TransformLogic.RunSurfaceCA(
             *                  TransformLogic.RunCA(
             *                      FaceLogic.FaceArrayToByteArray(
             *                          //FaceLogic.DoubleSize(
             *                          FaceLogic.GetFaces(
             *                                  TransformLogic.RunThinningCA(
             *                                      TransformLogic.ScalePartial(TransformLogic.VoxListToArray(voxels, PaletteDraw.sizex, PaletteDraw.sizey, PaletteDraw.sizez), 2.0),
             *                                  2)//1 + OrthoSingle.multiplier * OrthoSingle.bonus / 2)
             *                              )
             *
             *                      ),
             *                  2)
             *          );
             */
        }
Exemplo n.º 2
0
        public void DetectFace_InvalidImageFormat_ResponseDataMustBeNull()
        {
            _faceAPI.Setup(api => api.Detect("a"))
            .Returns(Task.FromResult(new HttpResponseMessage {
                StatusCode = HttpStatusCode.BadRequest
            }));

            _responseHelper.Setup(rh => rh.CreateResponse <DetectedFaceDto[]>(
                                      It.Is <HttpResponseMessage>(res => !res.IsSuccessStatusCode),
                                      It.IsAny <string>()))
            .Returns(new Response {
                Data = null
            });

            _faceLogic = new FaceLogic(_faceAPI.Object, _responseHelper.Object);

            var result = _faceLogic.DetectFace("a");

            Assert.That(result.Data, Is.Null);
        }
Exemplo n.º 3
0
        public void IdentifyFace_WhenCalled_ReturnAString(HttpStatusCode httpStatusCode)
        {
            _faceAPI.Setup(api => api.Identify(new List <string> {
                "a"
            }, "a"))
            .Returns(Task.FromResult(new HttpResponseMessage {
                StatusCode = httpStatusCode, Content = new StringContent("")
            }));

            _responseHelper.Setup(rh => rh.JsonPrettyPrint(
                                      It.IsAny <HttpResponseMessage>()))
            .Returns(string.Empty);

            _faceLogic = new FaceLogic(_faceAPI.Object, _responseHelper.Object);

            var result = _faceLogic.IdentifyFace(new List <string> {
                "a"
            }, "a");

            Assert.That(result, Is.TypeOf <string>());
        }
Exemplo n.º 4
0
        public void DetectFace_ValidImageFormat_ResponseDataMustBeAnObject()
        {
            _faceAPI.Setup(api => api.Detect("a"))
            .Returns(Task.FromResult(new HttpResponseMessage {
                StatusCode = HttpStatusCode.OK
            }));

            _responseHelper.Setup(rh => rh.CreateResponse <DetectedFaceDto[]>(
                                      It.Is <HttpResponseMessage>(res => res.IsSuccessStatusCode),
                                      It.IsAny <string>()))
            .Returns(new Response {
                Data = new DetectedFaceDto[] { new DetectedFaceDto {
                                                   FaceId = "abc"
                                               } }
            });

            _faceLogic = new FaceLogic(_faceAPI.Object, _responseHelper.Object);

            var result = _faceLogic.DetectFace("a");

            Assert.That(((DetectedFaceDto[])result.Data)[0].FaceId, Is.EqualTo("abc"));
        }
Exemplo n.º 5
0
        public void DetectFace_ImagePathIsNullOrEmpty_ThrowArgumentNullException(string error)
        {
            _faceLogic = new FaceLogic(_faceAPI.Object, _responseHelper.Object);

            Assert.That(() => _faceLogic.DetectFace(error), Throws.ArgumentNullException);
        }
Exemplo n.º 6
0
 public void SetUp()
 {
     _faceAPI        = new Mock <IFaceAPI>();
     _responseHelper = new Mock <IResponseHelper>();
     _faceLogic      = new FaceLogic(_faceAPI.Object, _responseHelper.Object);
 }
Exemplo n.º 7
0
        public void IdentifyFace_PersonGroupIsNullOrEmpty_ThrowArgumentNullException(string error)
        {
            _faceLogic = new FaceLogic(_faceAPI.Object, _responseHelper.Object);

            Assert.That(() => _faceLogic.IdentifyFace(new List <string>(), error), Throws.ArgumentNullException);
        }
Exemplo n.º 8
0
        public void IdentifyFace_FaceIDIsNull_ThrowArgumentNullException()
        {
            _faceLogic = new FaceLogic(_faceAPI.Object, _responseHelper.Object);

            Assert.That(() => _faceLogic.IdentifyFace(null, "a"), Throws.ArgumentNullException);
        }