ナンバープレート識別--S 5 PV 210テスト2回目の最適化
7689 ワード
最適化:
1、RGB回転HSV浮動小数点演算を定点演算に変更する;
2、マッチングテンプレートを画像からC言語配列に変更する.
3、BMPナンバープレート画像の読み取りを最適化する(2層forサイクルを1層forサイクルに変更する);
全体的に最適化前より110 ms程度時間が減少した.
640 x 480:160 ms程度
320 x 240:55 ms程度
現在、時間に影響を与える問題は、浮動小数点ではなく、大量のforサイクルでの演算であり、60%の時間がナンバープレートの位置決めに使用され、ナンバープレートが位置決めされると、後の文字分割とマッチングは10 ms程度の時間で完了する.
テストで使用したノートブックI 3-380 cpuと比較し、仮想マシンの実行結果
640 X 480:27 ms程度
320 x 240:9 ms程度
比較ME 865(OMAP 4430)
640 x 480:130 ms程度
320 x 240:50 msくらい
1、RGB回転HSV浮動小数点演算を定点演算に変更する;
2、マッチングテンプレートを画像からC言語配列に変更する.
3、BMPナンバープレート画像の読み取りを最適化する(2層forサイクルを1層forサイクルに変更する);
全体的に最適化前より110 ms程度時間が減少した.
640 x 480:160 ms程度
320 x 240:55 ms程度
[liujia@210]#./car test/1.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
ÔÁ A F Q 7 8 7
Total Time: time use:158ms
[liujia@210]#./car test/2.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
ÔÁ A 8 S 3 0 8
Total Time: time use:162ms
[liujia@210]#./car test/3.bmp
BMP Size:230454, Info_length:54, H:320, W:240
The Car ID IS:
ÔÁ A G F 7 5 1
Total Time: time use:57ms
[liujia@210]#./car test/4.bmp
BMP Size:230454, Info_length:54, H:320, W:240
The Car ID IS:
ÔÁ A 8 S 3 0 8
Total Time: time use:55ms
[liujia@210]#./car test/5.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
ÔÁ M 0 7 3 6 9
Total Time: time use:141ms
[liujia@210]#./car test/6.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
ÔÁ A 6 Y 2 6 8
Total Time: time use:163ms
[liujia@210]#./car test/7.bmp
BMP Size:230454, Info_length:54, H:320, W:240
The Car ID IS:
ÔÁ A 9 X 6 6 7
Total Time: time use:59ms
[liujia@210]#./car test/8.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
ÔÁ A P 6 8 3 8
Total Time: time use:186ms
[liujia@210]#./car test/9.bmp
BMP Size:879414, Info_length:54, H:640, W:458
The Car ID IS:
ÔÁ A F N 5 5 3
Total Time: time use:167ms
[liujia@210]#./car test/10.bmp
BMP Size:1004214, Info_length:54, H:640, W:523
The Car ID IS:
Íî J 0 8 0 3 6
Total Time: time use:169ms
[liujia@210]#./car test/11.bmp
BMP Size:1035978, Info_length:54, H:665, W:519
The Car ID IS:
ËÕ B H 6 0 8 2
Total Time: time use:172ms
[liujia@210]#./car test/12.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
ÔÁ A F Z 9 0 5
Total Time: time use:172ms
[liujia@210]#./car test/13.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
ÔÁ A A D 2 6 3
Total Time: time use:172ms
現在、時間に影響を与える問題は、浮動小数点ではなく、大量のforサイクルでの演算であり、60%の時間がナンバープレートの位置決めに使用され、ナンバープレートが位置決めされると、後の文字分割とマッチングは10 ms程度の時間で完了する.
テストで使用したノートブックI 3-380 cpuと比較し、仮想マシンの実行結果
640 X 480:27 ms程度
320 x 240:9 ms程度
root@lj:/work/carid/0532# ./car test/1.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
▒▒ A F Q 7 8 7
Total Time: time use:27ms
root@lj:/work/carid/0532# ./car test/2.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
▒▒ A 8 S 3 0 8
Total Time: time use:103ms
root@lj:/work/carid/0532# ./car test/3.bmp
BMP Size:230454, Info_length:54, H:320, W:240
The Car ID IS:
▒▒ A G F 7 5 1
Total Time: time use:9ms
root@lj:/work/carid/0532# ./car test/4.bmp
BMP Size:230454, Info_length:54, H:320, W:240
The Car ID IS:
▒▒ A 8 S 3 0 8
Total Time: time use:9ms
root@lj:/work/carid/0532# ./car test/5.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
▒▒ M 0 7 3 6 9
Total Time: time use:23ms
root@lj:/work/carid/0532# ./car test/6.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
▒▒ A 6 Y 2 6 8
Total Time: time use:33ms
root@lj:/work/carid/0532# ./car test/7.bmp
BMP Size:230454, Info_length:54, H:320, W:240
The Car ID IS:
▒▒ A 9 X 6 6 7
Total Time: time use:9ms
root@lj:/work/carid/0532# ./car test/8.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
▒▒ A P 6 8 3 8
Total Time: time use:28ms
root@lj:/work/carid/0532# ./car test/9.bmp
BMP Size:879414, Info_length:54, H:640, W:458
The Car ID IS:
▒▒ A F N 5 5 3
Total Time: time use:25ms
root@lj:/work/carid/0532# ./car test/10.bmp
BMP Size:1004214, Info_length:54, H:640, W:523
The Car ID IS:
▒▒ J 0 8 0 3 6
Total Time: time use:27ms
root@lj:/work/carid/0532# ./car test/11.bmp
BMP Size:1035978, Info_length:54, H:665, W:519
The Car ID IS:
▒▒ B H 6 0 8 2
Total Time: time use:27ms
root@lj:/work/carid/0532# ./car test/12.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
▒▒ A F Z 9 0 5
Total Time: time use:27ms
root@lj:/work/carid/0532# ./car test/13.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
▒▒ A A D 2 6 3
Total Time: time use:25ms
比較ME 865(OMAP 4430)
640 x 480:130 ms程度
320 x 240:50 msくらい
root@edison:/data # ./car /sdcard/test/1.bmp
./car /sdcard/test/1.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
A F Q 7 8 7
Total Time: time use:122ms
root@edison:/data # ./car /sdcard/test/2.bmp
./car /sdcard/test/2.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
A 8 S 3 0 8
Total Time: time use:125ms
root@edison:/data # ./car /sdcard/test/3.bmp
./car /sdcard/test/3.bmp
BMP Size:230454, Info_length:54, H:320, W:240
The Car ID IS:
A G F 7 5 1
Total Time: time use:50ms
root@edison:/data # ./car /sdcard/test/4.bmp
./car /sdcard/test/4.bmp
BMP Size:230454, Info_length:54, H:320, W:240
The Car ID IS:
A 8 S 3 0 8
Total Time: time use:42ms
root@edison:/data # ./car /sdcard/test/5.bmp
./car /sdcard/test/5.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
M 0 7 3 6 9
Total Time: time use:94ms
root@edison:/data # ./car /sdcard/test/6.bmp
./car /sdcard/test/6.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
A 6 Y 2 6 8
Total Time: time use:134ms
root@edison:/data # ./car /sdcard/test/7.bmp
./car /sdcard/test/7.bmp
BMP Size:230454, Info_length:54, H:320, W:240
The Car ID IS:
A 9 X 6 6 7
Total Time: time use:51ms
root@edison:/data # ./car /sdcard/test/8.bmp
./car /sdcard/test/8.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
A P 6 8 3 8
Total Time: time use:132ms
root@edison:/data # ./car /sdcard/test/9.bmp
./car /sdcard/test/9.bmp
BMP Size:879414, Info_length:54, H:640, W:458
The Car ID IS:
A F N 5 5 3
Total Time: time use:124ms
root@edison:/data # ./car /sdcard/test/10.bmp
./car /sdcard/test/10.bmp
BMP Size:1004214, Info_length:54, H:640, W:523
The Car ID IS:
J 0 8 0 3 6
Total Time: time use:171ms
root@edison:/data # ./car /sdcard/test/11.bmp
./car /sdcard/test/11.bmp
BMP Size:1035978, Info_length:54, H:665, W:519
The Car ID IS:
B H 6 0 8 2
Total Time: time use:207ms
root@edison:/data # ./car /sdcard/test/12.bmp
./car /sdcard/test/12.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
A F Z 9 0 5
Total Time: time use:204ms
root@edison:/data # ./car /sdcard/test/13.bmp
./car /sdcard/test/13.bmp
BMP Size:921654, Info_length:54, H:640, W:480
The Car ID IS:
A A D 2 6 3
Total Time: time use:138ms