OCR识别
# PinToo之OCR识别
# 1. 说明
范例使用智能手机上的PinToo应用程序,通过WebAPI进行图片的识别。在使用该功能前需要获取百度智能云OCR识别 (opens new window)API Key与Secret Key。
通过范例,可以了解fxBaidyAPI的使用方法并结合实例进行识别功能的应用。
# 2. 设计明细
开启PinToo设计器,分别加入下插图之控件。或者点击左上角的[打开模板Lib文件]
,选择模板文件来打开对应模板。
①:TfxActionList组件,控件名称为fxActionList1
。
②:TfxImage组件,控件名称为fxImage1
。
③:TfxLabel组件,控件名称为fxLabel2
。
④:TfxBaiduAPI组件,控件名称为fxBaiduAPI1
。
⑤:TfxSuperButton组件,控件名称为fxSuperButtonTakePicture
。
⑥:TfxSuperButton组件,控件名称为fxSuperButtonLicensePlate
。
⑦:TfxSuperButton组件,控件名称为fxSuperButtonCarInfo
。
⑧:TfxSuperButton组件,控件名称为fxSuperButtonGeneral
。
fxRunFrame属性设置
Height
:设置页面高度=800
。Width
:设置页面宽度=400
。
①fxActionList1属性设置 双击
fxActionList
,在弹出的窗口中,添加一个TTakePhotoFromCameraAction
(从相机拍照获取图片)
②fxImage1属性设置
Height
:设置控件高度=380
。Width
:设置控件宽度=345
。WarpMode
:设置图像在控件中显示的模式,设置为Fit
,即图像适应于控件大小。Bitmap
:设置显示的图片,双击该属性或者点击属性右侧的[...]
打开图像编辑器。点击[Load...]
打开资源管理器,选择所需的图片后点击[打开]
,选择的图像会显示在预览框中。可在该页面下进行裁切或者缩放像素以使图像与控件的宽度高度相适应,修改完成后点击[OK]
按钮完成图像修改。
③fxLabel2属性设置
Height
:设置控件高度=30
。Width
:设置控件宽度=365
。Text
:设置文字内容=车牌识别结果:
TextSettings
:设置文字样式。其中Font.Size
=18
,Font.Style
中勾选fxBold
。使用该设置需要取消StyledSettings
中的全部勾选的选项。
④fxBaiduAPI1属性设置
APIKey
:输入设置的APIKey,该项在百度智能云OCR识别 (opens new window)获取。Secret
:输入设置的Secret,该项在百度智能云OCR识别 (opens new window)获取。
⑤fxSuperButtonTakePicture属性设置
Height
:设置控件高度=100
。Width
:设置控件宽度=100
。ButtonType
:设置按钮类型,设置为TfxSvgButton
。Name
:设置控件名称=fxSuperButtonTakePicture
。ColorBegin
:设置初始颜色=Aliceblue
。ButtonType.SvgData
:设置SVG数据,其数据内容如下。
<path d="M57.8489532470703,39.3008155822754 C49.4180603027344,39.3008155822754 42.5829429626465,46.1785163879395 42.5829429626465,54.6631469726563 C42.5829429626465,63.1477737426758 49.4180603027344,69.9089813232422 57.8489532470703,69.9089813232422 C66.2798538208008,69.9089813232422 72.9515609741211,63.1476821899414 72.9515609741211,54.6631469726563 C72.9515609741211,46.1786117553711 66.2799530029297,39.300910949707 57.8490524291992,39.300910949707 Z M88.7950897216797,22.4480495452881 L76.3694000244141,22.4480495452881 C73.0615234375,18.2100200653076 69.2181549072266,13.3009185791016 69.1645050048828,13.3009185791016 L42.0636749267578,13.3009185791016 C42.0000762939453,13.3009185791016 38.1155052185059,18.2101097106934 34.7738037109375,22.4479579925537 L11.2048139572144,22.4479579925537 C6.67267799377441,22.4479579925537 3,26.1207275390625 3,30.6528625488281 L3,78.4943542480469 C3,83.0264892578125 6.6726770401001,86.6990814208984 11.2048139572144,86.6990814208984 L88.7950973510742,86.6990814208984 C93.3272323608398,86.6990814208984 97,83.0264892578125 97,78.4943542480469 L97,30.6527709960938 C97,26.1206359863281 93.3271484375,22.447868347168 88.7950973510742,22.447868347168 Z M23.6263675689697,43.2264022827148 C21.0456867218018,43.2264022827148 18.9553356170654,41.1360473632813 18.9553356170654,38.5577659606934 C18.9553356170654,35.9771766662598 21.0456867218018,33.8867340087891 23.6263675689697,33.8867340087891 C26.2045574188232,33.8867340087891 28.2949123382568,35.9771766662598 28.2949123382568,38.5577659606934 C28.2949123382568,41.1359596252441 26.2045612335205,43.2264022827148 23.6263675689697,43.2264022827148 Z M58.1063804626465,75.1752319335938 C46.7592239379883,75.1752319335938 37.2203826904297,65.9184265136719 37.2203826904297,54.5018615722656 C37.2203826904297,43.0832672119141 46.7592239379883,33.8285789489746 58.1063804626465,33.8285789489746 C69.4512329101563,33.8285789489746 78.5356979370117,43.083179473877 78.5356979370117,54.5018615722656 C78.5356979370117,65.9183349609375 69.4512405395508,75.1752319335938 58.1063804626465,75.1752319335938 Z" p-id="2345" fill="#FF1296DB" stroke="Null"></path>
1⑥fxSuperButtonLicensePlate属性设置
Height
:设置控件高度=40
。Width
:设置控件宽度=120
。ButtonType
:设置按钮类型,设置为TfxSvgButton
。Name
:设置控件名称=fxSuperButtonLicensePlate
。ColorBegin
:设置初始颜色=Aliceblue
。ButtonType.AlgnType
:设置图像与文字的相对位置=aLeft
。ButtonType.Text
:设置按钮显示的文本内容=车牌识别
。ButtonType.TextSettings
:设置文本显示样式的选项,其中Font.Size = 18
,Font.Style
中将fsBold
勾选,HorzAlign
设置为Center
。ButtonType.SvgData
:设置SVG数据,其数据内容如下。
<path d="M26.6236400604248,12.9457225799561 L25.2702007293701,12.9457225799561 L25.2702007293701,13.9300413131714 L26.6236400604248,13.9300413131714 L26.6236400604248,12.9457225799561 Z M25.2291889190674,15.7756385803223 L26.2135066986084,15.7756385803223 C26.3365478515625,15.4475317001343 26.459587097168,15.119423866272 26.5005989074707,14.7503070831299 L25.2291889190674,14.7503070831299 L25.2291889190674,15.7756385803223 Z M33.4318428039551,5.80941390991211 L5.70687580108643,5.80941390991211 C4.18938493728638,5.80941390991211 3,6.79373264312744 3,7.98311710357666 L3,25.6188201904297 C3,26.234016418457 3.32810616493225,26.8082046508789 3.82026529312134,27.1773223876953 C4.35343790054321,27.587459564209 5.05066347122192,27.7925224304199 5.70687580108643,27.7925224304199 C6.19903469085693,27.7925224304199 6.65018081665039,27.6694831848145 7.10132646560669,27.4644165039063 C7.55247211456299,27.2593536376953 8.00361824035645,27.1773223876953 8.49577713012695,27.1773223876953 C8.98793697357178,27.1773223876953 9.43908309936523,27.2593536376953 9.89022827148438,27.4644165039063 L12.6381177902222,28.7358245849609 C13.0892629623413,28.9408950805664 13.5404090881348,29.0229187011719 14.0325679779053,29.0229187011719 C14.5247268676758,29.0229187011719 14.9758720397949,28.9408950805664 15.4270191192627,28.7358245849609 L18.1749076843262,27.4644165039063 C18.6260528564453,27.2593536376953 19.0771999359131,27.1773223876953 19.5693588256836,27.1773223876953 L19.610372543335,27.1773223876953 C19.5693588256836,26.8492164611816 19.5693588256836,26.5621223449707 19.5693588256836,26.275032043457 C19.5693588256836,23.6091690063477 20.6767177581787,21.2304000854492 22.4402885437012,19.5078430175781 L22.4402885437012,17.4981918334961 L21.2098903656006,17.4981918334961 C21.1688785552979,18.9336585998535 20.9227981567383,20.3691215515137 20.4716510772705,21.7225608825684 C20.1845588684082,21.5585060119629 19.8564529418945,21.4764785766602 19.5283451080322,21.3944511413574 C20.1025333404541,19.5488548278809 20.3486099243164,17.6212348937988 20.2665843963623,15.6525964736938 L20.2665843963623,11.264178276062 L21.2098903656006,11.264178276062 L21.2098903656006,14.135106086731 L22.0711708068848,14.135106086731 L22.0711708068848,11.0180978775024 L22.973461151123,11.0180978775024 L22.973461151123,14.135106086731 L23.7527141571045,14.135106086731 L23.7527141571045,15.0784139633179 L21.2098903656006,15.0784139633179 L21.2098903656006,16.5959014892578 L23.3425788879395,16.5959014892578 L23.3425788879395,18.7285919189453 C23.6296730041504,18.4825134277344 23.9577770233154,18.2774467468262 24.2858848571777,18.113395690918 C24.203857421875,18.072380065918 24.1628437042236,18.0313682556152 24.1218318939209,17.9493408203125 C24.7370300292969,17.6212348937988 25.2702007293701,17.1700897216797 25.6803340911865,16.6369171142578 L24.2448711395264,16.6369171142578 L24.2448711395264,12.1254577636719 L25.9674282073975,12.1254577636719 C26.0904693603516,11.7563381195068 26.1724948883057,11.4282331466675 26.2545223236084,11.0591135025024 L27.4849185943604,11.1821527481079 C27.3618793487549,11.5102586746216 27.2388381958008,11.8383655548096 27.0747852325439,12.1254577636719 L29.8636894226074,12.1254577636719 L29.8636894226074,16.6369171142578 L26.9107341766357,16.6369171142578 C26.8287048339844,16.800968170166 26.7056674957275,16.9650230407715 26.5826282501221,17.129077911377 C26.7876930236816,17.088062286377 26.9927616119385,17.0060348510742 27.2388381958008,16.9650230407715 L27.2388381958008,16.800968170166 L28.2641716003418,16.800968170166 C28.5512638092041,16.7599563598633 28.797342300415,16.7599563598633 29.084436416626,16.7599563598633 C31.9143505096436,16.7599563598633 34.4161605834961,17.9903526306152 36.1797294616699,19.9589920043945 L36.1797294616699,7.98311710357666 C36.1387176513672,6.79373264312744 34.949333190918,5.80941390991211 33.4318428039551,5.80941390991211 Z M19.2412528991699,19.5488586425781 L15.2629661560059,19.5488586425781 L15.2629661560059,21.6405334472656 L14.1145944595337,21.6405334472656 L14.1145944595337,19.5488586425781 L9.02894973754883,19.5488586425781 L9.02894973754883,18.4825134277344 L14.1145963668823,18.4825134277344 L14.1145963668823,16.9650230407715 L11.5717735290527,16.9650230407715 C11.1206274032593,16.9240112304688 10.7104949951172,16.9650230407715 10.3003616333008,17.129077911377 C10.177321434021,16.7599563598633 10.0542821884155,16.3908386230469 9.89022827148438,16.0217170715332 C10.177321434021,15.9396915435791 10.4234008789063,15.6525993347168 10.7104930877686,15.1194267272949 C10.9975872039795,14.6682806015015 11.2846794128418,14.176121711731 11.5307598114014,13.6839618682861 L9.23401641845703,13.6839618682861 L9.23401641845703,12.6586303710938 L12.0229187011719,12.6586303710938 C12.2689981460571,12.0844449996948 12.5150766372681,11.5102586746216 12.6791305541992,10.936074256897 L13.9095277786255,11.2641792297363 C13.7454748153687,11.7153253555298 13.5404081344604,12.2074842453003 13.2943286895752,12.6586303710938 L19.0361862182617,12.6586303710938 L19.0361862182617,13.6839618682861 L12.802170753479,13.6839618682861 C12.3920383453369,14.4632139205933 11.9408931732178,15.201452255249 11.4487323760986,15.9396905899048 L14.1145963668823,15.9396905899048 L14.1145963668823,14.2991609573364 L15.2629680633545,14.2991609573364 L15.2629680633545,15.9396905899048 L18.2569351196289,15.9396905899048 L18.2569351196289,16.9650192260742 L15.2629680633545,16.9650192260742 L15.2629680633545,18.4825134277344 L19.2412548065186,18.4825134277344 L19.2412548065186,19.5488586425781 Z M27.5669441223145,12.9457225799561 L27.5669441223145,13.9300413131714 L28.797342300415,13.9300413131714 L28.797342300415,12.9457225799561 L27.5669441223145,12.9457225799561 Z M27.2798519134521,15.7756385803223 L28.8383541107178,15.7756385803223 L28.8383541107178,14.7503070831299 L27.5259304046631,14.7503070831299 C27.4849166870117,15.0784139633179 27.402889251709,15.4475317001343 27.2798500061035,15.7756385803223 Z" p-id="1749" fill="#FF1296DB" stroke="Null"></path> <path d="M29.084436416626,18.3594741821289 C24.7370300292969,18.3594741821289 21.1688785552979,21.8866119384766 21.1688785552979,26.2750358581543 C21.1688785552979,30.6224365234375 24.6960163116455,34.1905860900879 29.0844383239746,34.1905860900879 C33.4318466186523,34.1905860900879 37,30.6634521484375 37,26.275032043457 C36.9589805603027,21.8866119384766 33.4318428039551,18.3594741821289 29.084436416626,18.3594741821289 Z M32.9396820068359,24.3474082946777 C31.709285736084,26.0289535522461 30.4788875579834,27.7104988098145 29.2074756622314,29.3510246276855 C28.9613952636719,29.720142364502 28.3461971282959,29.9662208557129 27.9360637664795,29.6381149291992 C27.0337734222412,29.0229187011719 26.1724948883057,28.4077186584473 25.2702045440674,27.7925224304199 C24.860071182251,27.505428314209 24.6550045013428,27.0542831420898 24.9420986175537,26.6031341552734 C25.1881790161133,26.234016418457 25.8033771514893,26.0289497375488 26.213508605957,26.3160438537598 L28.1821460723877,27.6694831848145 C29.2074794769287,26.275032043457 30.2738227844238,24.8395690917969 31.2991542816162,23.4451179504395 C31.9963798522949,22.5428237915039 33.6369094848633,23.4041061401367 32.9396858215332,24.3474082946777 Z M32.9396820068359,24.3474082946777 Z" p-id="1750" fill="#FF1296DB" stroke="Null"></path>
1
2⑦fxSuperButtonCarInfo属性设置
Height
:设置控件高度=40
。Width
:设置控件宽度=120
。ButtonType
:设置按钮类型,设置为TfxSvgButton
。Name
:设置控件名称=fxSuperButtonCarInfo
。ColorBegin
:设置初始颜色=Aliceblue
。ButtonType.AlgnType
:设置图像与文字的相对位置=aLeft
。ButtonType.Text
:设置按钮显示的文本内容=车型识别
。ButtonType.TextSettings
:设置文本显示样式的选项,其中Font.Size = 18
,Font.Style
中将fsBold
勾选,HorzAlign
设置为Center
。ButtonType.SvgData
:设置SVG数据,其数据内容如下。
<path d="M32.4038467407227,35.355770111084 C31.7884616851807,35.355770111084 31.307689666748,34.855770111084 31.307689666748,34.2596168518066 L31.307689666748,31.875 C31.307689666748,31.2596168518066 31.8076915740967,30.7788467407227 32.4038467407227,30.7788467407227 C33,30.7788467407227 33.5,31.2788467407227 33.5,31.875 L33.5,34.2596168518066 C33.5,34.855770111084 33,35.355770111084 32.4038467407227,35.355770111084 Z" p-id="2040" fill="#FF1296DB" stroke="Null"></path> <path d="M35.0576934814453,23.0480766296387 L33.480770111084,23.0480766296387 C32.8653831481934,23.0480766296387 32.3846130371094,22.5480766296387 32.3846130371094,21.9519233703613 C32.3846130371094,21.355770111084 32.8846130371094,20.855770111084 33.480770111084,20.855770111084 L35.0576934814453,20.855770111084 C35.6730766296387,20.855770111084 36.1538467407227,21.355770111084 36.1538467407227,21.9519233703613 C36.1538467407227,22.5480766296387 35.6730766296387,23.0480766296387 35.0576934814453,23.0480766296387 Z" p-id="2041" fill="#FF1296DB" stroke="Null"></path> <path d="M21.9230766296387,35.8173065185547 L5.75,35.8173065185547 C4.23076915740967,35.8173065185547 3,34.586540222168 3,33.0673065185547 L3,9.41346073150635 C3,7.89423084259033 4.23076915740967,6.66346120834351 5.75,6.66346120834351 L9.42307758331299,6.66346263885498 C10.0384616851807,6.66346263885498 10.5192317962646,7.16346263885498 10.5192317962646,7.75961685180664 C10.5192317962646,8.37500190734863 10.0192317962646,8.8557710647583 9.42307758331299,8.8557710647583 L5.75,8.8557710647583 C5.442307472229,8.8557710647583 5.19230794906616,9.10577011108398 5.19230794906616,9.41346263885498 L5.19230794906616,33.0673065185547 C5.19230794906616,33.375 5.442307472229,33.6250038146973 5.75,33.6250038146973 L21.9230766296387,33.625 C22.230770111084,33.625 22.480770111084,33.375 22.480770111084,33.0673065185547 L22.480770111084,9.41346073150635 C22.480770111084,9.10576915740967 22.230770111084,8.85576915740967 21.9230766296387,8.85576915740967 L18.3269233703613,8.8557710647583 C17.7115364074707,8.8557710647583 17.230770111084,8.3557710647583 17.230770111084,7.75961589813232 C17.230770111084,7.14423131942749 17.730770111084,6.66346216201782 18.3269233703613,6.66346216201782 L21.9230766296387,6.66346263885498 C23.4423065185547,6.66346263885498 24.6730785369873,7.89423179626465 24.6730785369873,9.4134635925293 L24.6730785369873,33.0673065185547 C24.6730785369873,34.567310333252 23.4423065185547,35.8173065185547 21.9230766296387,35.8173065185547 Z" p-id="2042" fill="#FF1296DB" stroke="Null"></path> <path d="M17.5384635925293,6.37500095367432 L10.115385055542,6.37500095367432 C9.5,6.37500095367432 9.01923084259033,5.87500095367432 9.01923084259033,5.27884721755981 C9.01923084259033,4.68269348144531 9.51922988891602,4.18269348144531 10.115385055542,4.18269348144531 L17.5384616851807,4.18269348144531 C18.1538467407227,4.18269348144531 18.6346130371094,4.68269348144531 18.6346130371094,5.27884721755981 C18.6346130371094,5.87500095367432 18.1538467407227,6.37500095367432 17.5384635925293,6.37500095367432 Z" p-id="2043" fill="#FF1296DB" stroke="Null"></path> <path d="M25.8076953887939,17.6634635925293 L24.4230785369873,17.6634635925293 C23.8076915740967,17.6634635925293 23.3269214630127,17.163459777832 23.3269214630127,16.567310333252 C23.3269214630127,15.9711561203003 23.8269214630127,15.471155166626 24.4230785369873,15.471155166626 L25.8076953887939,15.471155166626 C26.42307472229,15.471155166626 26.9038467407227,15.9711561203003 26.9038467407227,16.567310333252 C26.9038467407227,17.163459777832 26.42307472229,17.6634635925293 25.8076953887939,17.6634635925293 Z" p-id="2044" fill="#FF1296DB" stroke="Null"></path> <path d="M33.538459777832,26.0480766296387 C32.980770111084,26.0480766296387 32.5192337036133,25.644229888916 32.4423065185547,25.086540222168 L31.7307682037354,19.1250038146973 C31.7307682037354,19.1057739257813 31.7307682037354,19.067310333252 31.7307682037354,19.0480804443359 C31.6923065185547,18.6442337036133 31.4999980926514,17.6826972961426 30.2499961853027,17.6826972961426 L24.4230785369873,17.6826934814453 C23.8076915740967,17.6826934814453 23.3269214630127,17.1826934814453 23.3269214630127,16.586540222168 C23.3269214630127,15.9903879165649 23.8269214630127,15.4903860092163 24.4230785369873,15.4903860092163 L30.2500019073486,15.4903860092163 C32.8076934814453,15.4903860092163 33.8461532592773,17.5288467407227 33.9230804443359,18.9134635925293 L34.6346130371094,24.855770111084 C34.7115364074707,25.4519233703613 34.2692260742188,26.0096168518066 33.6730766296387,26.086540222168 C33.6346130371094,26.0480766296387 33.5769195556641,26.0480766296387 33.538459777832,26.0480766296387 Z" p-id="2045" fill="#FF1296DB" stroke="Null"></path> <path d="M34.25,32.9134635925293 L23.5576915740967,32.9134635925293 C22.9423122406006,32.9134635925293 22.461540222168,32.4134635925293 22.461540222168,31.817310333252 C22.461540222168,31.2211570739746 22.961540222168,30.7211532592773 23.5576915740967,30.7211532592773 L34.25,30.7211532592773 C34.5576934814453,30.7211532592773 34.8076934814453,30.4711532592773 34.8076934814453,30.163459777832 L34.8076934814453,27.0288467407227 C34.8076934814453,26.7211532592773 34.5576934814453,26.4711532592773 34.25,26.4711532592773 L23.5576915740967,26.4711532592773 C22.9423122406006,26.4711532592773 22.461540222168,25.9711532592773 22.461540222168,25.3749961853027 C22.461540222168,24.7596130371094 22.961540222168,24.2788429260254 23.5576915740967,24.2788429260254 L34.25,24.2788429260254 C35.769229888916,24.2788429260254 37,25.5096130371094 37,27.0288429260254 L37,30.1634559631348 C37,31.6826934814453 35.769229888916,32.9134635925293 34.25,32.9134635925293 Z" p-id="2046" fill="#FF1296DB" stroke="Null"></path> <path d="M32.0769271850586,28.5480804443359 M30.6923084259033,28.5480804443359 C30.6923084259033,29.3127822875977 31.312219619751,29.9326934814453 32.0769271850586,29.9326934814453 C32.8416213989258,29.9326934814453 33.461540222168,29.3127822875977 33.461540222168,28.5480804443359 C33.461540222168,27.783374786377 32.8416213989258,27.1634635925293 32.0769271850586,27.1634635925293 C31.312219619751,27.1634635925293 30.6923084259033,27.783374786377 30.6923084259033,28.5480804443359 Z" p-id="2047" fill="#FF1296DB" stroke="Null"></path> <path d="M13.288462638855,25.7403869628906 C12.673077583313,25.7403869628906 12.1923084259033,25.2403869628906 12.1923084259033,24.644229888916 L12.1923084259033,21.7788467407227 C12.1923084259033,21.1634635925293 12.6923093795776,20.682689666748 13.288462638855,20.682689666748 C14.8846158981323,20.682689666748 16.1730766296387,19.394229888916 16.1730766296387,17.7980766296387 C16.1730766296387,16.2019195556641 14.884614944458,14.9134616851807 13.288462638855,14.9134616851807 C11.6923084259033,14.9134616851807 10.4038467407227,16.2019233703613 10.4038467407227,17.7980766296387 C10.4038467407227,18.413459777832 9.90384769439697,18.894229888916 9.30769348144531,18.894229888916 C8.69230842590332,18.894229888916 8.21153831481934,18.394229888916 8.21153831481934,17.7980766296387 C8.21153831481934,14.9903841018677 10.4807682037354,12.7211532592773 13.288462638855,12.7211532592773 C16.096155166626,12.7211532592773 18.3653831481934,14.9903860092163 18.3653831481934,17.7980766296387 C18.3653831481934,20.2211532592773 16.6538467407227,22.2596168518066 14.3846158981323,22.7596130371094 L14.3846158981323,24.644229888916 C14.3846158981323,25.2596168518066 13.884614944458,25.7403869628906 13.288462638855,25.7403869628906 Z" p-id="2048" fill="#FF1296DB" stroke="Null"></path> <path d="M13.25,31.4519233703613 C12.634614944458,31.4519233703613 12.1538467407227,30.9519195556641 12.1538467407227,30.3557662963867 L12.1538467407227,28.1634635925293 C12.1538467407227,27.5480766296387 12.6538467407227,27.0673065185547 13.25,27.0673065185547 C13.8653841018677,27.0673065185547 14.3461532592773,27.567310333252 14.3461532592773,28.1634635925293 L14.3461532592773,30.3557662963867 C14.3461542129517,30.9519233703613 13.8461542129517,31.4519233703613 13.25,31.4519233703613 Z" p-id="2049" fill="#FF1296DB" stroke="Null"></path>
1
2
3
4
5
6
7
8
9
10⑧fxSuperButtonGeneral属性设置
Height
:设置控件高度=40
。Width
:设置控件宽度=120
。ButtonType
:设置按钮类型,设置为TfxSvgButton
。Name
:设置控件名称=fxSuperButtonGeneral
。ColorBegin
:设置初始颜色=Aliceblue
。ButtonType.AlgnType
:设置图像与文字的相对位置=aLeft
。ButtonType.Text
:设置按钮显示的文本内容=文字识别
。ButtonType.TextSettings
:设置文本显示样式的选项,其中Font.Size = 18
,Font.Style
中将fsBold
勾选,HorzAlign
设置为Center
。ButtonType.SvgData
:设置SVG数据,其数据内容如下。
<path d="M29.9081687927246,3.0073025226593 C31.0216674804688,2.88192749023438 32.0508728027344,3.62284421920776 32.3009185791016,4.72855234146118 L33.7841682434082,5.27255249023438 L33.782039642334,5.27963542938232 C35.5939559936523,5.94051074981689 37,8.08392715454102 37,10.1565103530884 L37,30.0450916290283 C37,32.1226348876953 35.5847473144531,34.2561340332031 33.7622108459473,34.9028396606445 L32.2385864257813,35.4482574462891 C31.9465465545654,36.3543701171875 31.1059532165527,36.9707565307617 30.153959274292,36.9768447875977 C29.364875793457,36.9768447875977 28.6352882385254,36.5518417358398 28.2400379180908,35.8590927124023 C27.8452796936035,35.165771484375 27.8450107574463,34.3157501220703 28.239330291748,33.6221771240234 C28.6292591094971,32.9324111938477 29.3594856262207,32.5050964355469 30.1518306732178,32.5030059814453 C30.7723293304443,32.5037155151367 31.3630771636963,32.7721710205078 31.7774543762207,33.2396697998047 L33.0326232910156,32.7905883789063 C33.9796676635742,32.4534225463867 34.7935409545898,31.1706295013428 34.7935409545898,30.0408382415771 L34.7935409545898,10.1529693603516 C34.7935409545898,9.02105236053467 33.9789581298828,7.72480297088623 33.0347480773926,7.3791356086731 L31.6421661376953,6.8648853302002 C31.239631652832,7.24310684204102 30.7084312438965,7.45426988601685 30.1560840606689,7.45563650131226 C28.9363346099854,7.45563650131226 27.9475002288818,6.45334434509277 27.9475002288818,5.21801137924194 C27.9510440826416,4.08397006988525 28.7946643829346,3.13267827033997 29.9081687927246,3.00730299949646 Z M10.2830829620361,2.97684407234192 C11.2925567626953,2.98394060134888 12.1694364547729,3.67291808128357 12.4151668548584,4.65205240249634 C12.6687908172607,5.63305997848511 12.2348527908325,6.66250085830688 11.3555002212524,7.16592788696289 C10.4796571731567,7.66216278076172 9.3782787322998,7.49701452255249 8.68650054931641,6.76571941375732 L6.98508358001709,7.38338613510132 C6.05150032043457,7.72267818450928 5.20716667175293,8.90417671203613 5.20716667175293,9.91001129150391 L5.20716667175293,30.2767181396484 C5.20716667175293,31.2790069580078 6.05150032043457,32.4463424682617 6.98508310317993,32.7792587280273 L8.57529163360596,33.3338851928711 C8.98782348632813,32.8088989257813 9.61754035949707,32.5010833740234 10.2852077484131,32.4980545043945 L10.2852077484131,32.490966796875 C10.871000289917,32.490966796875 11.431999206543,32.7275466918945 11.8456659317017,33.1468811035156 C12.2593336105347,33.5669250488281 12.4902496337891,34.1357192993164 12.4902496337891,34.7285919189453 C12.482458114624,35.7939224243164 11.7365827560425,36.7069625854492 10.7045412063599,36.9138031005859 C9.66792869567871,37.1180725097656 8.6317253112793,36.5600433349609 8.23174953460693,35.5821380615234 L6.25549936294556,34.8858413696289 C4.44570827484131,34.2412567138672 3,32.2154235839844 3,30.2724666595459 L3,9.90575981140137 C3,7.96776103973389 4.43508338928223,5.93201065063477 6.23566675186157,5.27680206298828 L8.17862510681152,4.57555246353149 C8.44650077819824,3.6345329284668 9.30328178405762,2.98321676254272 10.2816667556763,2.97684407234192 Z M21.7269153594971,10.0601768493652 L30.625,29.8935089111328 L26.6370811462402,29.8793411254883 L26.6384983062744,29.8793411254883 L24.8039131164551,25.7674674987793 L15.7329998016357,25.7674674987793 L14.0131664276123,29.8460521697998 L10.0833330154419,29.8935089111328 L18.4409561157227,10.0941781997681 L21.7276248931885,10.0601778030396 Z M20.138126373291,15.3082189559937 L17.2481250762939,22.1648845672607 L23.1967086791992,22.1648845672607 L20.138126373291,15.308219909668 Z" p-id="2796" fill="#FF1296DB" stroke="Null"></path>
1
# 3. 程序设计
点击程序设计界面右下角的按钮,切换至单元选择界面,勾选需要使用的单元。该程序需要引用 uBaiduAPI
单元。
# 3.1. 程序初始设置
该程序无初始设置。
# 3.2. 事件设置
- ⑤fxSuperButtonTakePicture-OnClick事件
点击按钮,打开照相界面拍摄图像。
Procedure fxSuperButtonTakePictureOnClick(Sender: TObject);
//拍照
Begin
TakePhotoFromCameraAction1.ExecuteTarget(nil);
End;
2
3
4
5
- ①fxActionList1.TakePhotoFromCameraAction1-OnFinishTaking事件
当照相机获取到图像后,将图像传递给图像控件。
Procedure TakePhotoFromCameraAction1OnDidFinishTaking(Image: TBitmap);
//结束拍照,回传照片
Begin
fximage1.Bitmap.Assign(Image);
End;
2
3
4
5
- ⑥fxSuperButtonLicensePlate-OnClick事件
当点击[车牌识别]
按钮后,进行车牌识别。
Procedure fxSuperButtonLicensePlateOnClick(Sender: TObject);
//识别车牌
Begin
fxBaiduAPI1.doBitmapToLicensePlate(fxImage1.Bitmap);
End;
2
3
4
5
- ④fxBaiduAPI1-OnlicensePlate事件
当控件接收到车牌识别的结果时,显示在标签控件中。
- ⑦fxSuperButtonCarInfo-OnClick事件
当点击[车型识别]
按钮后,进行车型识别。
Procedure fxSuperButtonCarInfoOnClick(Sender: TObject);
//识别车型
Begin
ShowMessage(fxBaiduAPI1.doBitmapToCarInfo(fxImage1.Bitmap));
End;
2
3
4
5
- ⑧fxSuperButtonGeneral-OnClick事件
当点击[文字识别]
按钮后,进行通用文字识别并返回识别的结果。
Procedure fxSuperButtonGeneralOnClick(Sender: TObject);
//通用文字识别
Begin
ShowMessage(fxBaiduAPI1.doBitmapToGeneralBasic(fxImage1.Bitmap));
End;
2
3
4
5
# 4. 运行结果
使用鼠标在 PinToo 菜单,点击[保存至数据库]
按钮,将其保存至数据库,点击[调试运行]
确认能够正常打开。
通过同步中心,将程序上传至手机PinToo运行;同步时,请确保手机已经运行PinToo,并且已经登陆。
点击拍照按钮进行拍照,拍照完成后返回到程序界面,点击[车牌识别]
、[车型识别]
、[文字识别]
按钮进行对应的操作。查看识别的结果。