def test_estimate_head_pose_by_image_and_bounding_box_empty_bounding_box(self): """ Estimating head pose by image and empty bounding box """ fakeDetection = Detection(RectFloat(0.0, 0.0, 0.0, 0.0), 0.9) bBox = BoundingBox(fakeDetection) with pytest.raises(LunaSDKException) as exceptionInfo: self.headPoseEstimator.estimateByBoundingBox(ImageWithFaceDetection(self.image, bBox)) self.assertLunaVlError(exceptionInfo, LunaVLError.InvalidDetection.format("Invalid detection"))
def test_estimate_head_pose_by_image_and_bounding_box_without_intersection(self): """ Estimating head pose by image and bounding box without intersection """ fakeDetection = Detection(RectFloat(3000.0, 3000.0, 100.0, 100.0), 0.9) bBox = BoundingBox(fakeDetection) with pytest.raises(LunaSDKException) as exceptionInfo: self.headPoseEstimator.estimateByBoundingBox(ImageWithFaceDetection(self.image, bBox)) self.assertLunaVlError(exceptionInfo, LunaVLError.InvalidRect.format("Invalid rectangle"))
def test_estimate_head_pose_by_image_and_bounding_box_empty_bounding_box( self): """ Estimating head pose by image and empty bounding box """ fakeDetection = DetectionFloat(RectFloat(0.0, 0.0, 0.0, 0.0), 0.9) bBox = BoundingBox(fakeDetection) with pytest.raises(LunaSDKException) as exceptionInfo: TestHeadPose.headPoseEstimator.estimateByBoundingBox( bBox, self.image) self.assertLunaVlError(exceptionInfo, LunaVLError.InvalidRect)
def test_estimate_background_by_image_and_bounding_box_without_intersection( self): """ Estimating background by image and bounding box without intersection """ fakeDetection = Detection(RectFloat(3000.0, 3000.0, 100.0, 100.0), 0.9) bBox = BoundingBox(fakeDetection) with pytest.raises(LunaSDKException) as exceptionInfo: self.backgroundEstimator.estimate( ImageWithFaceDetection(VLImage.load(filename=ONE_FACE), bBox)) self.assertLunaVlError( exceptionInfo, LunaVLError.InvalidRect.format("Invalid rectangle"))
def test_estimate_background_by_image_and_bounding_box_empty_bounding_box( self): """ Estimating background by image and empty bounding box """ fakeDetection = Detection(RectFloat(0.0, 0.0, 0.0, 0.0), 0.9) bBox = BoundingBox(fakeDetection) with pytest.raises(LunaSDKException) as exceptionInfo: self.backgroundEstimator.estimate( ImageWithFaceDetection(VLImage.load(filename=ONE_FACE), bBox)) self.assertLunaVlError( exceptionInfo, LunaVLError.InvalidDetection.format("Invalid detection"))