Hi Imran,
We have followed your way to identify patch and barcode but still it took 5 minutes.
We have about 165 images and an IFO file.
Is there any way to improve the performance to a little.
Please find the zipped attachment.
Code we have used is pasted below, Please have a look
private int ReadImageBarcodesWithAspose(ref ACS.PMO.IFOComp.IFOImage image)
{
if (image.ImageName.ToUpper().IndexOf(“C”) != -1)
return 0;
string FullImageName = image[“ImageName”];
if (FullImageName == null || FullImageName.Trim() == string.Empty)
throw new Exception(“IFO Line With No ImageName Attribute Found.”);
if (!System.IO.File.Exists(FullImageName))
throw new Exception(“Image Not Found At Path '” + FullImageName + “’.”);
int BarCodeCount = 0;
try
{
using (BarCodeReader reader = new BarCodeReader(FullImageName, BarCodeReadType.PatchCode | BarCodeReadType.Code39Standard))
{
while (reader.Read())
{
string getType = reader.GetReadType().ToString();
// Console.WriteLine("Code Text: " + reader.GetCodeText() + " Type: " + reader.GetReadType());
// PatchCode = reader.GetCodeText();
string bc = reader.GetCodeText().ToString();
if (image[“PatchCode”] == null && !getType.ToUpper().Equals(“CODE39STANDARD”) )
{
switch (bc.ToUpper())
{
case “PATCH I”:
case “PATCHI”:
case “PATCH 1”:
case “PATCH1”:
//PatchCode = “PATCH2”;
image[“PatchCode”] = “Patch1”;
break;
case “PATCH II”:
case “PATCHII”:
case “PATCH 2”:
case “PATCH2”:
//PatchCode = “PATCH2”;
image[“PatchCode”] = “Patch2”;
break;
case “PATCH III”:
case “PATCHIII”:
case “PATCH 3”:
case “PATCH3”:
//PatchCode = “PATCH2”;
image[“PatchCode”] = “Patch3”;
break;
case “PATCH IV”:
case “PATCHIV”:
case “PATCH 4”:
case “PATCH4”:
image[“PatchCode”] = “Patch4”;
break;
case “PATCH V”:
case “PATCHV”:
case “PATCH 5”:
case “PATCH5”:
image[“PatchCode”] = “Patch5”;
break;
case “PATCH VI”:
case “PATCHVI”:
case “PATCH 6”:
case “PATCH6”:
image[“PatchCode”] = “Patch6”;
break;
}
}
// – we want to check the barcode against the regex
// – if we don’t find a match, throw this barcode away
// – but only do this logic if they have at least one regex defined
IDictionaryEnumerator masks = filters.GetEnumerator();
while (masks.MoveNext())
{
if (Regex.IsMatch(bc, Convert.ToString(masks.Value), RegexOptions.IgnoreCase)) //f))
{
BarCodeCount++;
image[String.Format(“BarCode{0}”, BarCodeCount)] = bc;
// image[Convert.ToString(masks.Key)] = BarCodeList[i].BarcodeValue;
//break;
}
}
}
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return BarCodeCount;
}