/* * Description: * Find the largest license plate in the image * - Segment using ThresholdHSVchannels * - Remove blobs which are not license plates * Input: * //Original image * RGB888Image plateImage * Output: * //Segmented license plate * ref Int32Image binaryPlateImage * Return: * //License plate found? * bool */ public static bool FindPlate(RGB888Image plateImage, ref Int32Image binaryPlateImage) { try { VisionLab.SetRGB888Image(cmdInt, "plateImage", plateImage); String result = StripTime(cmdInt.ExecRequest("icall FindPlate plateImage binaryPlateImage")); if (result == "true") { VisionLab.GetInt32Image(cmdInt, "binaryPlateImage", binaryPlateImage); } return(result == "true"); } catch (System.Exception ex) { throw new Exception("FindPlate: " + ex.Message); } }
/* * Description: * Locates the characters of the license plate * - Warp image (Rectify) * - Segment characters * - Remove blobs which are to small (Lines between characters) * Input: * //Original image * RGB888Image plateImage * //Segmented license plate * Int32Image binaryPlateImage * Output: * //Image containing binary six characters * ref Int32Image binaryCharacterImage * Return: * //Function executed successfully * bool */ public static bool FindCharacters(RGB888Image plateImage, Int32Image binaryPlateImage, ref Int32Image binaryCharacterImage) { try { VisionLab.SetRGB888Image(cmdInt, "plateImage", plateImage); VisionLab.SetInt32Image(cmdInt, "binaryPlateImage", binaryPlateImage); String result = StripTime(cmdInt.ExecRequest("icall FindCharacters plateImage binaryPlateImage binaryCharacterImage")); if (result == "true") { VisionLab.GetInt32Image(cmdInt, "binaryCharacterImage", binaryCharacterImage); } return(result == "true"); } catch (System.Exception ex) { //if (ex.Message.StartsWith("[DefaultLUTForImage]")) // return false; ////if (ex.Message.Substring(0, 6) == "[DefaultLUTForImage]") //// return false; throw new Exception("FindCharacters: " + ex.Message); } }