46 lines
1.8 KiB
C#
46 lines
1.8 KiB
C#
using DeepLearning_Model_Sharp;
|
|
using OpenCvSharp;
|
|
|
|
namespace Inno.LPR
|
|
{
|
|
public class LicensePlateRecognitionMotionData
|
|
{
|
|
public Mat OriginalImage { get; private set; }
|
|
public DateTime ImageCreatedTime { get; init; }
|
|
public List<LPR_Boxes> DetectedLprBoxList { get; init; } = [];
|
|
public LPR_Boxes SelectedTrustedLprBox { get; private set; }
|
|
public bool IsLicensePlateExist { get; private set; } = false;
|
|
public List<string> LicensePlateCodeList { get; set; } = [];
|
|
public string LicensePlateCode { get; private set; } = string.Empty;
|
|
public int FrameNumber { get; set; } = -1;
|
|
|
|
public LicensePlateRecognitionMotionData(Mat originalImage, DateTime imageCreatedTime, List<LPR_Boxes> lprBoxes, bool isLicensePlateExist)
|
|
{
|
|
OriginalImage = originalImage.Clone();
|
|
ImageCreatedTime = imageCreatedTime;
|
|
DetectedLprBoxList.AddRange(lprBoxes);
|
|
if (DetectedLprBoxList.Count > 0)
|
|
{
|
|
SelectedTrustedLprBox = DetectedLprBoxList.OrderByDescending(box => box.y).First();
|
|
}
|
|
IsLicensePlateExist = isLicensePlateExist;
|
|
}
|
|
|
|
public void DrawLicensePlateCharacterBoxes(List<LPR_Boxes> boxes, uint coordinateOriginX, uint coordinateOriginY)
|
|
{
|
|
if (!IsLicensePlateExist) { return; }
|
|
|
|
//foreach (_LPR_Boxes mLPR_Chars in boxes)
|
|
//{
|
|
// Rect rect_Char = new((int)mLPR_Chars.x + (int)coordinateOriginX, (int)mLPR_Chars.y + (int)coordinateOriginY,
|
|
// (int)mLPR_Chars.w, (int)mLPR_Chars.h);
|
|
// Cv2.Rectangle(LicensePlateDisplayImage, rect_Char, Scalar.Blue, 1);
|
|
//}
|
|
}
|
|
public void AddLicensePlateCode(string lpCode)
|
|
{
|
|
LicensePlateCode = lpCode;
|
|
}
|
|
}
|
|
}
|