田潤瀾,王乃強,蘆志強
(1.空軍航空大學,吉林長春,130000;2.山東科技大學,山東泰安,271000)
基于iOS的移動智能多條碼掃描識別技術的應用
田潤瀾1,王乃強2,蘆志強2
(1.空軍航空大學,吉林長春,130000;2.山東科技大學,山東泰安,271000)
條碼掃描器,又稱為條碼閱讀器、條碼掃描槍。它利用光學原理把條形碼的內容解碼后自我處理或者傳輸到電腦或別的設備實現某一用途。未來,隨著物聯網概念及相關產業的不斷發展,對條碼識讀設備的投資建設需求不斷增加,條碼識別產業將直接受益于物聯網所帶動的投資增長。
條碼批量掃描;多條碼掃描;移動終端條碼識別
隨著零售業和消費市場的飛速擴大和發展,也促進了中國條碼標簽業務的增長。因為越來越多的地方需要用到標簽和條碼。在現在生活中,條碼和自動識別系統和數據采集技術依然在全球范圍發揮著至關重要的作用。
對于大部分的現代化倉庫管理的需求都能滿足。把種類繁瑣的工作瞬間化煩為易,查詢貨物的時候特別方便,不需再耗費很多的人力去翻查種類繁多的出進貨單據。
而面對類似倉庫管理,物流集裝裝配等同類型多條碼的掃描工作,大型PC半移動式條碼掃描槍明顯暴露了它的弊端:移動不便,單一識別,一日內重復大量單一掃描動作,效率低下。用著名掃描元器件廠商的移動掃描PDA彌補這一缺陷的話,額外成本支出上升,這個PDA價格昂貴不易維修,且不支持多條碼掃描識別技術,不能解決掃描員重復單一掃描工作量大的問題。
iOS,蘋果公司開發的移動操作用于iPhone,iPod touch,iPad等移動只能設備系統。其中iPod touch的價格已經到了普通群眾都可以接受的千元機,基于iOS操作系統的多條碼快速識別推薦使用iPod touch,大大降低了掃描成本,而且杜絕了安卓系統的頓卡等通病,顯著提高了掃描員的工作效率。
程序語言Objective-C,實現平臺:Xcode。
蘋果公司官方語言中, AVFoundation是一個可以用來使用和創建基于時間的視聽媒體的框架,需要開發自定義的拍照和錄制視頻功能,可借助于AVFoundation框架來實現,該框架提供了大量的類來完成拍照和錄制視頻。
在配置攝像頭的相關屬性之前,必須先調用lock For Configuration:方法執行鎖定,配置完成后調用unlockForConfiguration方法解鎖。AVCaptureSession :該對象負責把AVCaptureDevice捕捉得到的視頻或聲音數據輸出到輸出設備中.不管執行實時的還是離線的錄制,開發者都必須創建AVCaptureSession對象,并為該對象添加輸入設備(負責捕捉數據)和輸出端(負責接收數據).以下是實現該功能的部分設計程序:
注釋:添加并且設置預覽圖層
self.previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:_captureSession];
self.previewLayer.videoGravity = AVLayerVideoGravit yResizeAspectFill;
self.previewLayer.frame = self.view.bounds;
[self.view.layer addSublayer:self.previewLayer]; self.targetLayer = [CALayer layer]; self.targetLayer. frame = self.view.bounds; [self.view.layer addSublayer:self.targetLayer];
注釋:輸出掃描對象之后的方法
-(void)captureOutput:(AVCaptureOutput *) captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *) connection
{self.codeObjectsArr = nil;
if (metadataObjects != nil && [metadataObjects count] > 0)
{注釋:循環解析掃描到的所有條碼對象
for (AVMetadataMachineReadableCodeObject *metadataObject in metadataObjects)
{if ([[metadataObject type] isEqualToString:@”org. iso.QRCode”]||[[metadataObject type] isEqualToString:@”org.iso.PDF417”])
{ data = [metadataObject stringValue]; [self. dataArr addObject:data];
AVMetadataObject *transformedObject = [self. previewLayer transformedMetadataObjectForMetadataObject :metadataObject];
注釋:存儲每一個條碼內容對象到現有數組中
[self.codeObjectsArr addObject:transformedObject];
[self performSelectorOnMainThread:@ selector(stopReading) withObject:nil waitUntilDone:NO]; } }
此種批量條碼、批量類型的掃描識別技術將為和人們息息相關的各種產業和領域帶來極大的便利,時代高速發展的今天,效率就是效益。相信在不久的將來,多條碼掃描識別將會有更大的進步,也將為人們的生活提供質的飛躍。
Application of mobile intelligent multi barcode scanning recognition technology based on iOS
Tian Runlan, Wang Naiqiang, Lu Zhiqiang
(1.Air Force Aviation University,Changchun Jilin 130000; 2.Shandong University of Science and Technology Taian Shandong,271000)
Bar code scanner, also known as bar code reader, bar code scanning gun. It uses optical principles to decode the contents of a bar code, process it itself, or transmit it to a computer or other device for a particular purpose. In the future, with the continuous development of the concept of Internet of things and related industries, the demand for investment and construction of bar code recognition equipment is increasing, and the barcode recognition industry will benefit directly from the investment growth driven by the Internet of things.
bar code batch scanning; multi barcode scanning; mobile terminal bar code identification

圖1 應用效果
田潤瀾,女,工學博士,副教授 ,研究方向雷達工程、信號處理。