Class BarCodeReader
ชื่อพื้นที่: Aspose.BarCode.BarCodeRecognition การประกอบ: Aspose.BarCode.dll (25.4.0)
BarCodeReader encapsulates ภาพที่อาจมีหนึ่งหรือหลายรหัสบาร์แล้วสามารถดําเนินการ ReadBarCodes เพื่อตรวจจับรหัสบาร์
[XmlSerialization(Name = "Aspose.BarCode.Reader.Properties")]
public class BarCodeReader : IDisposable
Inheritance
Implements
อนุญาโตตุลาการ
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
Constructors
BarCodeReader()
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.BarCode.BarCodeRecognition.BarCodeReader ด้วยค่าเริ่มต้นต้องการตั้งค่าภาพ (SetBitmapImage()) ก่อนที่จะเรียกวิธีการ ReadBarCodes().
public BarCodeReader()
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128);
reader.SetBarCodeImage(@"c:\test.png");
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128)
reader.SetBarCodeImage("c:\test.png")
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
BarCodeReader(Bitmap)
public BarCodeReader(Bitmap image)
Parameters
image
Bitmap
BarCodeReader(Bitmap, คู่มือ BaseDecodeType[])
public BarCodeReader(Bitmap image, params BaseDecodeType[] decodeTypes)
Parameters
image
Bitmap
decodeTypes
BaseDecodeType
[ ]
BarCodeReader(Bitmap, BaseDecodeType)
public BarCodeReader(Bitmap image, BaseDecodeType type)
Parameters
image
Bitmap
type
BaseDecodeType
BarCodeReader(Bitmap, Rectangle, พาราม BaseDecodeType[])
public BarCodeReader(Bitmap image, Rectangle area, params BaseDecodeType[] decodeTypes)
Parameters
image
Bitmap
area
Rectangle
decodeTypes
BaseDecodeType
[ ]
BarCodeReader(Bitmap, Rectangle, BaseDecodeType)
public BarCodeReader(Bitmap image, Rectangle area, BaseDecodeType type)
Parameters
image
Bitmap
area
Rectangle
type
BaseDecodeType
BarCodeReader(Bitmap และ Rectangle[ ], คู่มือ BaseDecodeType[])
public BarCodeReader(Bitmap image, Rectangle[] areas, params BaseDecodeType[] decodeTypes)
Parameters
image
Bitmap
areas
คู่มือ [ ]
decodeTypes
BaseDecodeType
[ ]
BarCodeReader(Bitmap และ Rectangle[ ], BaseDecodeประเภท)
public BarCodeReader(Bitmap image, Rectangle[] areas, BaseDecodeType type)
Parameters
image
Bitmap
areas
คู่มือ [ ]
type
BaseDecodeType
BarCodeReader(รั้ว)
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.BarCode.BarCodeRecognition.BarCodeReader จากไฟล์
public BarCodeReader(string filename)
Parameters
filename
string
ชื่อฟิล์ม
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png"))
{
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128);
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using reader As New BarCodeReader("c:\test.png")
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
BarCodeReader(ลวด, params BaseDecodeType[])
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.BarCode.BarCodeRecognition.BarCodeReader
public BarCodeReader(string filename, params BaseDecodeType[] decodeTypes)
Parameters
filename
string
ชื่อฟิล์ม
decodeTypes
BaseDecodeType
[ ]
ประเภท Decode
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
BarCodeReader(ลวด, BaseDecodeType)
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.BarCode.BarCodeRecognition.BarCodeReader
public BarCodeReader(string filename, BaseDecodeType type)
Parameters
filename
string
ชื่อฟิล์ม
type
BaseDecodeType
ประเภทการตกแต่ง
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", new MultyDecodeType(DecodeType.Code39, DecodeType.Code128)))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using reader As New BarCodeReader("c:\test.png", New MultyDecodeType(DecodeType.Code39, DecodeType.Code128))
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
BarCodeReader(Stream)
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.BarCode.BarCodeRecognition.BarCodeReader
public BarCodeReader(Stream stream)
Parameters
stream
Stream
กระแส
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (FileStream fstr = new FileStream(@"c:\test.png", FileMode.Open))
using (BarCodeReader reader = new BarCodeReader(fstr))
{
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128);
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using fstr = New FileStream("c:\test.png", FileMode.Open)
Using reader As New BarCodeReader(fstr)
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using
BarCodeReader(กระแส, BaseDecodeType)
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.BarCode.BarCodeRecognition.BarCodeReader
public BarCodeReader(Stream stream, BaseDecodeType type)
Parameters
stream
Stream
กระแส
type
BaseDecodeType
ประเภทการตกแต่ง
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (FileStream fstr = new FileStream(@"c:\test.png", FileMode.Open))
using (BarCodeReader reader = new BarCodeReader(fstr, new MultyDecodeType(DecodeType.Code39, DecodeType.Code128)))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using fstr = New FileStream("c:\test.png", FileMode.Open)
Using reader As New BarCodeReader(fstr, New MultyDecodeType(DecodeType.Code39, DecodeType.Code128))
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using
BarCodeReader(กระแส, params BaseDecodeType[])
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.BarCode.BarCodeRecognition.BarCodeReader
public BarCodeReader(Stream stream, params BaseDecodeType[] decodeTypes)
Parameters
stream
Stream
กระแส
decodeTypes
BaseDecodeType
[ ]
ประเภท Decode
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (FileStream fstr = new FileStream(@"c:\test.png", FileMode.Open))
using (BarCodeReader reader = new BarCodeReader(fstr, DecodeType.Code39, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using fstr = New FileStream("c:\test.png", FileMode.Open)
Using reader As New BarCodeReader(fstr, DecodeType.Code39, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using
Properties
BarcodeSettings
พารามิเตอร์หลัก BarCode decoding ประกอบด้วยพารามิเตอร์ที่ส่งผลกระทบต่อข้อมูลที่ได้รับการยอมรับ
[XmlSerialization(Type = XmlSerializationType.Element)]
public BarcodeSettings BarcodeSettings { get; }
คุณสมบัติมูลค่า
FoundBarCodes
ได้รับการยอมรับ Aspose.BarCode.BarCodeRecognition.BarCodeResults array
public BarCodeResult[] FoundBarCodes { get; }
คุณสมบัติมูลค่า
BarCodeResult [ ]
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการอ่านรหัสบาร์ด้วย BarCodeReader
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39, DecodeType.Code128))
{
reader.ReadBarCodes();
for(int i = 0; reader.FoundCount > i; ++i)
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes[i].CodeText);
}
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39, DecodeType.Code128)
reader.ReadBarCodes()
For i As Integer = 0 To reader.FoundCount - 1 Step 1
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes(i).CodeText)
Next
End Using
FoundCount
ได้รับการยอมรับบาร์โค้ดคํานวณ
public int FoundCount { get; }
คุณสมบัติมูลค่า
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการอ่านรหัสบาร์ด้วย BarCodeReader
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39, DecodeType.Code128))
{
reader.ReadBarCodes();
for(int i = 0; reader.FoundCount > i; ++i)
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes[i].CodeText);
}
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39, DecodeType.Code128)
reader.ReadBarCodes()
For i As Integer = 0 To reader.FoundCount - 1 Step 1
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes(i).CodeText)
Next
End Using
ProcessorSettings
ได้รับการตั้งค่าของการใช้ Core Processor
public static ProcessorSettings ProcessorSettings { get; }
คุณสมบัติมูลค่า
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการใช้ ProcessorSettings เพื่อเพิ่มประสิทธิภาพหลายชั้นสูงสุด
//this allows to use all cores for single BarCodeReader call
BarCodeReader.ProcessorSettings.UseAllCores = true;
//this allows to use current count of cores
BarCodeReader.ProcessorSettings.UseAllCores = false;
BarCodeReader.ProcessorSettings.UseOnlyThisCoresCount = Math.Max(1, Environment.ProcessorCount / 2);
'this allows to use all cores for single BarCodeReader call
BarCodeReader.ProcessorSettings.UseAllCores = True
'this allows to use current count of cores
BarCodeReader.ProcessorSettings.UseAllCores = False
BarCodeReader.ProcessorSettings.UseOnlyThisCoresCount = Math.Max(1, Environment.ProcessorCount / 2)
QualitySettings
QualitySettings ช่วยให้การกําหนดคุณภาพการรับรู้และความเร็วด้วยตนเองคุณสามารถตั้งค่า QualitySettings ได้อย่างรวดเร็วโดยการตั้งค่าแบบกําหนดเอง: HighPerformance, NormalQuality,HighQuality, MaxBarCodes หรือคุณสามารถตั้งค่าตัวเลือกแยกได้ด้วยตนเองค่าเริ่มต้นของ QualitySettings เป็น NormalQuality
[XmlSerialization(Type = XmlSerializationType.Element)]
public QualitySettings QualitySettings { get; set; }
คุณสมบัติมูลค่า
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการใช้ QualitySettings กับ BarCodeReader
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39, DecodeType.Code128))
{
//set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance;
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39, DecodeType.Code128))
{
//normal quality mode is set by default
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39, DecodeType.Code128))
{
//set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance;
//set separate options
reader.QualitySettings.AllowMedianSmoothing = true;
reader.QualitySettings.MedianSmoothingWindowSize = 5;
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39, DecodeType.Code128)
'set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Next
End Using
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39, DecodeType.Code128)
'normal quality mode is set by default
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Next
End Using
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39, DecodeType.Code128)
'set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance
'set separate options
reader.QualitySettings.AllowMedianSmoothing = True
reader.QualitySettings.MedianSmoothingWindowSize = 5
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Next
End Using
Timeout
ได้รับหรือตั้งค่าระยะเวลาของกระบวนการรับรู้ใน milliseconds
[XmlSerialization(Type = XmlSerializationType.Element)]
public int Timeout { get; set; }
คุณสมบัติมูลค่า
Examples
ตัวอย่างนี้แสดงให้เห็นว่าวิธีการหลีกเลี่ยงการยอมรับของสุนัขด้วย Timeount บนภาพขนาดใหญ่
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png"))
{
reader.Timeout = 5000;
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
Using reader As New BarCodeReader("c:\test.png")
reader.Timeout = 5000
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
Methods
Abort()
ฟังก์ชั่นต้องหยุดการประชุมการรับรู้ปัจจุบันจาก thread อะไหล่ อะไหล่เป็นวิธีการที่ไม่สามารถล็อคได้และกลับการควบคุมทันทีหลังจากการโทรวิธีการควรใช้เมื่อกระบวนการรับรู้เป็นเวลานานเกินไป
public void Abort()
Examples
ตัวอย่างนี้แสดงให้เห็นว่าวิธีการเรียกฟังก์ชั่นการระงับจาก thread อื่น ๆ
private static void ThreadRecognize(object readerObj)
{
BarCodeReader reader = (BarCodeReader)readerObj;
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeType);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39, DecodeType.Code128);
Thread thread1 = new Thread(ThreadRecognize);
thread1.Start(reader);
Thread.Sleep(100);
reader.Abort();
Private Shared Sub ThreadRecognize(readerObj As Object)
Dim reader As BarCodeReader = readerObj
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Sub
Dim reader As New BarCodeReader("c:\test.png", DecodeType.Code39, DecodeType.Code128)
Dim thread1 As New Thread(AddressOf ThreadRecognize)
thread1.Start(reader)
Thread.Sleep(100)
reader.Abort()
Dispose()
public void Dispose()
ExportToXml(รั้ว)
ส่งออกคุณสมบัติ BarCode ไปยังไฟล์ XML ที่ระบุไว้
public bool ExportToXml(string xmlFile)
Parameters
xmlFile
string
ชื่อของไฟล์
Returns
ไม่ว่าการส่งออกเสร็จสมบูรณ์อย่างประสบความสําเร็จ
Returns True ในกรณีที่ประสบความสําเร็จ False Otherwise
ExportToXml(Stream)
Export BarCode properties to the xml-stream specified
public bool ExportToXml(Stream xmlStream)
Parameters
xmlStream
Stream
กระแส XML สําหรับการประหยัด
Returns
ไม่ว่าการส่งออกเสร็จสมบูรณ์อย่างประสบความสําเร็จ
Returns True ในกรณีที่ประสบความสําเร็จ False Otherwise
ImportFromXml(รั้ว)
นําเข้าคุณสมบัติ BarCode จากไฟล์ XML ที่ระบุไว้และนําไปใช้กับตัวอย่าง BarCodeReader ในปัจจุบัน
public static BarCodeReader ImportFromXml(string xmlFile)
Parameters
xmlFile
string
ชื่อของไฟล์
Returns
Returns True ในกรณีที่ประสบความสําเร็จ
False Otherwise
ImportFromXml(Stream)
นําเข้าคุณสมบัติ BarCode จาก dòng xml ที่ระบุและนําไปใช้กับตัวอย่าง BarCodeReader ในปัจจุบัน
public static BarCodeReader ImportFromXml(Stream xmlStream)
Parameters
xmlStream
Stream
xml-stream สําหรับการโหลด
Returns
Returns True ในกรณีที่ประสบความสําเร็จ
False Otherwise
ReadBarCodes()
อ่าน Aspose.BarCode.BarCodeRecognition.BarCodeResults จากภาพ
public BarCodeResult[] ReadBarCodes()
Returns
BarCodeResult [ ]
Returns array of recognised Aspose.BarCode.BarCodeRecognition.BarCodeResults on the image. ถ้าไม่มีอะไรจะได้รับการยอมรับ, zero array จะถูกคืน.
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการอ่านรหัสบาร์ด้วย BarCodeReader
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39, DecodeType.Code128))
{
reader.ReadBarCodes();
for(int i = 0; reader.FoundCount > i; ++i)
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes[i].CodeText);
}
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39, DecodeType.Code128)
reader.ReadBarCodes()
For i As Integer = 0 To reader.FoundCount - 1 Step 1
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes(i).CodeText)
Next
End Using
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
SetBarCodeImage(Bitmap)
public void SetBarCodeImage(Bitmap value)
Parameters
value
Bitmap
SetBarCodeImage(Bitmap และ Rectangle[])
public void SetBarCodeImage(Bitmap value, Rectangle[] areas)
Parameters
value
Bitmap
areas
คู่มือ [ ]
SetBarCodeImage(Bitmap และ Rectangle)
public void SetBarCodeImage(Bitmap value, Rectangle area)
Parameters
value
Bitmap
area
Rectangle
SetBarCodeImage(รั้ว)
สร้างไฟล์ภาพสําหรับการรับรู้ต้องการเรียกก่อน ReadBarCodes() วิธีการ
public void SetBarCodeImage(string filename)
Parameters
filename
string
ไฟล์ภาพสําหรับ recogniton
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128);
reader.SetBarCodeImage(@"c:\test.png");
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128)
reader.SetBarCodeImage("c:\test.png")
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
SetBarCodeImage(Stream)
การตั้งค่าการไหลของภาพสําหรับการรับรู้ต้องการเรียกก่อน ReadBarCodes() วิธีการ
public void SetBarCodeImage(Stream stream)
Parameters
stream
Stream
การถ่ายโอนภาพสําหรับ recogniton
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (FileStream fstr = new FileStream(@"c:\test.png", FileMode.Open))
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128);
reader.SetBarCodeImage(fstr);
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using fstr = New FileStream("c:\test.png", FileMode.Open)
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128)
reader.SetBarCodeImage(fstr)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using
SetBarCodeReadType(params SingleDecodeType[])
ชุด Aspose.BarCode.BarCodeRecognition.SingleDecodeType ประเภทสําหรับการรับรู้ต้องการเรียกก่อน ReadBarCodes() วิธีการ
public void SetBarCodeReadType(params SingleDecodeType[] barcodeTypes)
Parameters
barcodeTypes
SingleDecodeType
[ ]
The Aspose.BarCode.BarCodeRecognition.SingleDecodeType ประเภทชุดที่จะอ่าน
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128);
reader.SetBarCodeImage(@"c:\test.png");
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(DecodeType.Code39, DecodeType.Code128)
reader.SetBarCodeImage("c:\test.png")
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
SetBarCodeReadType(BaseDecodeType)
การตั้งค่าประเภท decode สําหรับการรับรู้ต้องการเรียกก่อน ReadBarCodes() วิธีการ
[XmlSerialization(Name = "BarCodeReadType")]
public void SetBarCodeReadType(BaseDecodeType type)
Parameters
type
BaseDecodeType
ชนิดของบาร์โค้ดที่จะอ่าน
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการตรวจจับรหัสบาร์ Code39 และ Code128
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(new MultyDecodeType(DecodeType.Code39, DecodeType.Code128));
reader.SetBarCodeImage(@"c:\test.png");
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(New MultyDecodeType(DecodeType.Code39, DecodeType.Code128))
reader.SetBarCodeImage("c:\test.png")
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using