public FaceDetectBL() { // check if all libraries were loaded if (DependencyCheck.Execute()) { // does the file exist? if (File.Exists(fileNameHaarCascade)) { this.face = new HaarCascade(fileNameHaarCascade); } else { // the user has entered an invalid file name; let's try the default file name string defaultFileName = @".\haarcascade_frontalface_default.xml"; if (File.Exists(defaultFileName)) { this.face = new HaarCascade(defaultFileName); } else { throw new FaceDetectionException("Error while loading file: " + fileNameHaarCascade); } } } }
public CameraBL() { try { // check if all libraries were loaded if (DependencyCheck.Execute()) { // init grabber this.grabber = new Capture(); // get current height and width this.FrameWidth = grabber.GetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_WIDTH); this.FrameHeight = grabber.GetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT); } } catch (NullReferenceException) { this.IsCameraAvailable = false; } }