How to set barcodeRecognition in python sample code

  • 459 Views
  • Last Post 17 May 2016
Shinichi_Mimura posted this 11 May 2016

Hi,

I'm using process.py from python sample code.

"http://ocrsdk.com/documentation/quick-start/barcode-sdk/" guides the following steps to enable the barcode detection, but in the process.py "processor created by AbbyyOnlineSdk() needs to be used for passing username/password and I could't find out how to set the value of the profile parameter to barcodeRecognition.


Set the value of the profile parameter to barcodeRecognition. In this case only barcodes will be extracted during document processing. No other information will be read, therefore there is no need to specify the language parameter.

Select a suitable format of output file (the exportFormat parameter). The most suitable can be XML or TXT format. For example, XML output file can look like this:


Can you please let me know how to solve this?

Thanks,

Order By: Standard | Newest | Votes
Oksana Serdyuk posted this 11 May 2016

You just need to add "profile=barcodeRecognition" as a parameter of the processImage method to your request. To do so, change line 48 in the AbbyyOnlineSdk.py file to

requestUrl = self.ServerUrl + "processImage?profile=barcodeRecognition&" + urlParams

Shinichi_Mimura posted this 12 May 2016

Thank you for your answer. I tried, but just changing line 48 to "requestUrl = self.ServerUrl + "processImage?profile=barcodeRecognition&" + urlParamsv" returned an error "NameError: global name 'urlParamsv' is not defined". So I changed it to "requestUrl = self.ServerUrl + "processImage?profile=barcodeRecognition&" + urlParams"(v removed). However xml returned by the server seems to be corrupted like below;


PK    _rels/up 7・-_rels/PK  綏<德 .  _rels/.relsup u5(9_rels/.rels済;ツ0 ・・D゙iZПモ.ゥ+・7紘・ 償香#q20 bエ﨤・ンヒ・芟>hkY魂Rナ獎・k !r# 2・@]ヘg・モR襍 $)&0鐵tJ・q・ウM嗾ヨ・ヲメ+・8r・咏+・ ィ>LメHセ・迅rmサN ワZqムト'セI訖adpア^Rg・Z峰翡・PK    word/up Sword/PK  ┸ォH&aハQ・ 」  word/settings.xmlup r灸word/settings.xml拘ヒnロ0シ・シ;池(!r€ヨIz*研彧V狸,WV彑・渣_・廷8(R・閒ホ授ラ・・・-PイjU^*チーアaSォ゚・W*KャC」ィユ勅Y~・=T ・・・ゥjユ1ヌ*マ馴タ・・A-潰,Oレ・R 、$ゥ゙蝸E・5ノミ92リカヨタ M・・B・ヒ_、ホニ4ォ ・ケ・ホゥノユホ丸Z・ェIm皴!Lリッガヘ<|・夋>ッeqFボ彁J蘒}6T[勀ユュ・TセGZDネーヲ+b喨Q(汨H スソ・」 ・;@ Ιl0ネク{・iチmSォ筺ムrペZ奧}Oカd檸Yサヌィ・輦藏9*セ"bk゙。レ昃5Wヌワ[Y!繖?ヒ㍊:Mレ0ミT渠 tヌイ2・硺Vqハ@=・|・蝨;ロ・ーフ{・ト塚ハ奨オ・PK  ┸ォH叝騨・ フ   word/numbering.xmlup -'靖word/numbering.xml国ANト0 Eワ。ハセ・ ┐鯲fト ・!uァ・サイモホニ・q2j究 ・イ・・~N・#ーxツZ哿・ 5/オz}y.鬱!ノbc!ヤ・D搦・・゚€sーネ 3ユェKゥ7Z躯 ZルQ枠-qエ)キ|ムqモ39ノ・閾ェzヤムzT ・ィmス・ケ!ヲツlハgH轆YiSソラー拵tJ樒甄k50嚆VF・・T:廓径ヘムケル)ソョ琮テホUN]?o^p・PK  ┸ォH゚」モ ・   word/styles.xmlup ナユtSword/styles.xml侔ヘj1セ・駒ホョM(eノ:・@!・&hgスjF}オⅸ}・kiアラ&偬ミK|ムホァ儖」冩・・uEカ欺ォ貝/ 秩bコ詼U醍ァサノg庁」ェヲB+ィネ申マ?~ク鵯t[・・W替9S・イ$ナ m@F[I・・・ュ祭 =ソ(>蜥rE"・⑦7 gーミl-Aケ・A攸カワb・9tオ・ン^:⑩.v實qS揃Ued姨ホャFンク モイワH只~サ・2・-ホ・ノ損/~ュルコナl4」ユ/wZ9フコ・羮"O\兊-。ヒオ、セ訃 ン rzrウスQx:吾1怫#゚ンPQ胎eBnq・ェV 5yz侈 ス'モ踈fセfl・羞絜}ャ魏bww ウЦwセ輛 p・['・カッ€レ虚ョ・fテ・V2ア|c ミクネl(繃-^タKT鏝翅ニoチテリヘ.縡-(ョBv・FXセjモwテ-コ薰「・4ア・Eヒ・ユキ'p[緜 オteゥigスsEーzヌ/uE紡、D/NE%、ヒF8・y・ヲ・・ワ・修羊・ナクハ・・8/鶉#飾・゙ォミkスャeセqoィ7j! =T踪ヒム)シイ゙-・ソwヘ・H゚8PK  ┸ォHワノ n   word/footnotes.xmlup ?Nヤword/footnotes.xml葡チNテ0 ・HシC府ラ・BQロ]&^ x€(MラH・ルYテ檮焼+訊+ 。rqd・v>゙゙ォンォイム[Щl7・ネ hl-j・?・モV ヲ'テbラヷTQv・0ホXニZ・xYャ{・oミHオノゥ審:ゥレ0ァ+ワPワ募}癆qナミ v旌f嘱・・・Bz救 ョ%v~壘_・qャナ繊^iケウ嚼ア ケF'G7フ:黑w・=セシnヒ=gs「Yフ?斤カオH寞2忿ZッH、I醯★ェ丱溪ワ j綠メチツq・ソー髀,Rn>PK  ┸ォHⅣwfオ }  word/document.xmlup 誣マ゚word/document.xml拘Knロ0ン・ ・ノ6b;B・E址 ms ・噫IHA汐コW・G・:ヤヌI兇セヌ7o8テ_?~゙゙}ウfq・5コRャョrア ァーメョ)ナ・^,"IWI・Jq・・・ン・ウ濾チ.})Z"_dYT-Xッミツャニ%q址ヌP b・ヨd・゚fVj'&冪・ヨオVp?EI\Elオ承Z・足ゎ゚リ・ホ管Rtチ頓メj0bMK・8Z3シムエ愎ョ・・s簑マぷ)ュ=・ォノ!チy結セ8JS /DhE・ラルK3Z・V・・ク矣 +t、]ⅩL護・to[hセ|g・cオン昞・-・猤樢4wッ・+饌セ・ケyラ7・ト5P3sソケル、(隕}セ オス端・・ Y吊 フヲ#・U ・慘L蹼 Mzシ隘笙゚ュァc・]弼"・ヌォdN;xメ、ククヘ6沾i琦6オ・LiソPK   word/_rels/up 虫Oウword/_rels/PK  配・・ ャ  % word/_rels/document.xml.relsup! s覚ルword/_rels/document.xml.relsュ樽Nテ0・Hワチ・qレ"П拵RキU8€I&?j<cルSDホニ・q,%分界訳F~・セャ7onPッbマd大・ョ{j <涌7「Xェ暲・F顕)ョッヨ;ャ、Gア・Tノ・¨ト?hォ搓{、ヤi88+ゥ ュレロ・マ・・@q筰カオ・ュハム・シケi・ ケ:8$9。f!・・mhQ ・,ケ・ア・"ハ8L セ・9肓濘0、#8J・ngン侃シ・~農}rナPK  ・ 荷= $   [Content_Types].xmlup ・4[Content_Types].xmlオ・N1・$礰ケEY П6)・・タxg7{lル盗恪・qfレ・)ラoセ=レ浣・d髱X@ハ6)/僑€&T娚セN7RdメXiJケ・'胚ウムt! ヲ1羊Fo別f^・D@V齔シ&L濠レ|・ヤユpxュL@、オr<コⅦマ援%o・pY棺ヘ婉J」ウF・・沐チ6。r=堵6・征7。U・・゙#4@・ォュ・&b?メ・ Hカ=iマコ・ゥRU0sマL・ル槞um t|・S0・oヨサ「Sシカク{・ス=2ュ蒹キリ・孤ケζネ・tヨKヤ!:ナ3tヨ・Dフ彙[躱オチヌソPK     _rels/up 7・-_rels/PK   綏<德 .  3 _rels/.relsup u5(9_rels/.relsPK     * word/up Sword/PK   ┸ォH&aハQ・ 」  [ word/settings.xmlup r灸word/settings.xmlPK   ┸ォH叝騨・ フ   @ word/numbering.xmlup -'靖word/numbering.xmlPK   ┸ォH゚」モ ・   m word/styles.xmlup ナユtSword/styles.xmlPK   ┸ォHワノ n   ・ word/footnotes.xmlup ?Nヤword/footnotes.xmlPK   ┸ォHⅣwfオ }  Q word/document.xmlup 誣マ゚word/document.xmlPK    O word/_rels/up 虫Oウword/_rels/PK   配・・ ャ  % ・ word/_rels/document.xml.relsup! s覚ルword/_rels/document.xml.relsPK   ・ 荷= $   ヨ [Content_Types].xmlup ・4[Content_Types].xmlPK ァ


Do you have any suggestion?

Thanks,

Oksana Serdyuk posted this 12 May 2016

Yes, you are right, it was my misprint. I have already corrected my previous answer.

As for your recognition result, are you sure that you set the correct export format? I can see your recognition settings from our database, and it seems that you used the docx export format instead of xml. Please check it out.

Also I would recommend you to use any HTTP debugger (for example, Fiddler) to debug your code. It can be very useful during developing and for identifying the issues.

Shinichi_Mimura posted this 17 May 2016

It's solved. Thank you for your quick response!

Close