2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 namespace Tizen.Multimedia
22 /// This class represents concrete EngineConfig for Face detection and recognition
24 public class FaceEngineConfiguration : EngineConfiguration
26 // List of predefined keys
27 private const string _faceDetectionModelFilePathKey = "MV_FACE_DETECTION_MODEL_FILE_PATH";
28 private const string _faceRecognitionModelTypeKey = "MV_FACE_RECOGNITION_MODEL_TYPE";
29 private const string _faceDetectionRoiXKey = "MV_FACE_DETECTION_ROI_X";
30 private const string _faceDetectionRoiYKey = "MV_FACE_DETECTION_ROI_Y";
31 private const string _faceDetectionRoiWidthKey = "MV_FACE_DETECTION_ROI_WIDTH";
32 private const string _faceDetectionRoiHeightKey = "MV_FACE_DETECTION_ROI_HEIGHT";
33 private const string _faceDetectionMinWidthKey = "MV_FACE_DETECTION_MIN_SIZE_WIDTH";
34 private const string _faceDetectionMinHeightKey = "MV_FACE_DETECTION_MIN_SIZE_HEIGHT";
35 // Values are cached below to prevent interop calls for get operation
36 private string _faceDetectionModelFilePathValue;
37 private FaceRecognitionModelType _faceRecognitionModelTypeValue = FaceRecognitionModelType.LBPH;
38 private int _faceDetectionRoiXValue = -1;
39 private int _faceDetectionRoiYValue = -1;
40 private int _faceDetectionRoiWidthValue = -1;
41 private int _faceDetectionRoiHeightValue = -1;
42 private int _faceDetectionMinWidthValue = -1;
43 private int _faceDetectionMinHeightValue = -1;
46 /// The default constructor of FaceEngineConfig class
51 public FaceEngineConfiguration()
54 ModelFilePath = _faceDetectionModelFilePathValue;
55 ModelType = _faceRecognitionModelTypeValue; ;
56 MinimumHeight = _faceDetectionMinHeightValue;
57 MinimumWidth = _faceDetectionMinWidthValue;
58 RoiHeight = _faceDetectionRoiHeightValue;
59 RoiWidth = _faceDetectionRoiWidthValue;
60 RoiX = _faceDetectionRoiXValue;
61 RoiY = _faceDetectionRoiYValue;
65 /// Sets and gets face detection haarcascade xml file attribute of the engine configuration.
67 public string ModelFilePath
71 return _faceDetectionModelFilePathValue;
76 Add<string>(_faceDetectionModelFilePathKey, value);
77 _faceDetectionModelFilePathValue = value;
82 /// Sets and gets the method used for face recognition model learning attribute of the engine configuration.
84 public FaceRecognitionModelType ModelType
88 return _faceRecognitionModelTypeValue;
93 if (value == FaceRecognitionModelType.Unknown)
95 throw new ArgumentException("ModelType value is invalid");
98 Add<int>(_faceRecognitionModelTypeKey, (int)value);
99 _faceRecognitionModelTypeValue = value;
104 /// Sets and gets minimum height of face which will be detected as attribute of the engine configuration.
107 /// Default value is -1 (all detected faces will be applied) can be changed to specify the minimum face height.
109 public int MinimumHeight
113 return _faceDetectionMinHeightValue;
118 Add<int>(_faceDetectionMinHeightKey, value);
119 _faceDetectionMinHeightValue = value;
124 /// Sets and gets minimum width of face which will be detected as attribute of the engine configuration.
127 /// Default value is -1 (all detected faces will be applied) can be changed to specify the minimum face width.
129 public int MinimumWidth
133 return _faceDetectionMinWidthValue;
138 Add<int>(_faceDetectionMinWidthKey, value);
139 _faceDetectionMinWidthValue = value;
144 /// Sets and gets height of face detection roi as attribute of the engine configuration.
147 /// Default value is -1 (the roi will be a full image) can be changed to specify the roi for face detection.
153 return _faceDetectionRoiHeightValue;
158 Add<int>(_faceDetectionRoiHeightKey, value);
159 _faceDetectionRoiHeightValue = value;
164 /// Sets and gets width of face detection roi as attribute of the engine configuration.
167 /// Default value is -1 (the roi will be a full image) can be changed to specify the roi for face detection
173 return _faceDetectionRoiWidthValue;
178 Add<int>(_faceDetectionRoiWidthKey, value);
179 _faceDetectionRoiWidthValue = value;
184 /// Sets and gets X coordinate of face detection roi as attribute of the engine configuration.
187 /// Default value is -1 (the roi will be a full image) can be changed to specify the roi for face detection
193 return _faceDetectionRoiXValue;
198 Add<int>(_faceDetectionRoiXKey, value);
199 _faceDetectionRoiXValue = value;
204 /// Sets and gets Y coordinate of face detection roi as attribute of the engine configuration.
207 /// Default value is -1 (the roi will be a full image) can be changed to specify the roi for face detection
213 return _faceDetectionRoiYValue;
218 Add<int>(_faceDetectionRoiYKey, value);
219 _faceDetectionRoiYValue = value;