public ClsPrediction(ObjectType defaultObjType, Camera cam, ClsDeepstackDetection AiDetectionObject, ClsImageQueueItem curImg, ClsURLItem curURL) { this._defaultObjType = defaultObjType; this._cam = cam; this._curimg = curImg; this._cururl = curURL; //this._imageObject = AiDetectionObject; this.Camera = cam.Name; this.ImageHeight = curImg.Height; this.ImageWidth = curImg.Width; if (AiDetectionObject == null || cam == null || string.IsNullOrWhiteSpace(AiDetectionObject.label)) { Log("Error: Prediction or Camera was null?", "", this._cam.Name); this.Result = ResultType.Error; return; } //force first letter to always be capitalized this.Label = Global.UpperFirst(AiDetectionObject.label); this.XMax = AiDetectionObject.x_max; this.YMax = AiDetectionObject.y_max; this.XMin = AiDetectionObject.x_min; this.YMin = AiDetectionObject.y_min; this.Confidence = AiDetectionObject.confidence * 100; //store as whole number percent this.Filename = curImg.image_path; this.RectHeight = this.XMax - this.YMin; this.RectWidth = this.XMax - this.XMin; this.GetObjectType(); }
public ClsPrediction(ObjectType defaultObjType, Camera cam, ClsDeepstackDetection AiDetectionObject, ClsImageQueueItem curImg, ClsURLItem curURL) { this._defaultObjType = defaultObjType; this._cam = cam; this._curimg = curImg; this._cururl = curURL; this.Server = curURL.CurSrv; this.Time = DateTime.Now; //this._imageObject = AiDetectionObject; this.Camera = cam.Name; this.BICamName = cam.BICamName; this.ImageHeight = curImg.Height; this.ImageWidth = curImg.Width; this.Filename = curImg.image_path; if (AiDetectionObject == null || cam == null || (string.IsNullOrWhiteSpace(AiDetectionObject.label) && string.IsNullOrWhiteSpace(AiDetectionObject.UserID))) { Log("Error: Prediction or Camera was null?", "", this._cam.Name); this.Result = ResultType.Error; return; } //if running face detection: if (!string.IsNullOrWhiteSpace(AiDetectionObject.UserID)) { if (string.IsNullOrWhiteSpace(AiDetectionObject.label)) { AiDetectionObject.label = "Face"; } this.Label = AiDetectionObject.label.Trim(); this.Detail = Global.UpperFirst(AiDetectionObject.UserID); } else { //force first letter to always be capitalized this.Label = Global.UpperFirst(AiDetectionObject.label); } if (!string.IsNullOrEmpty(AiDetectionObject.Detail)) { this.Detail = Global.UpperFirst(AiDetectionObject.Detail); } this.XMax = AiDetectionObject.x_max; this.YMax = AiDetectionObject.y_max; this.XMin = AiDetectionObject.x_min; this.YMin = AiDetectionObject.y_min; this.Confidence = AiDetectionObject.confidence * 100; //store as whole number percent this.Filename = curImg.image_path; this.RectHeight = this.XMax - this.YMin; this.RectWidth = this.XMax - this.XMin; this.GetObjectType(); }