Project Sharing License plate recognition system based on ELF 1 development board

Mondo Technology Updated on 2024-03-06

The ELFBOARD ELF 1 development board was selected as the core hardware platform, and the camera connected to the USB interface was used to capture and recognize license plate information. Once the license plate is successfully recognized, the system will trigger a green light indication and transmit the recognized license plate number to the mobile app in real time. In terms of license plate recognition technology, the OCR (Optical Character Recognition) service is provided to ensure accurate and efficient reading of license plate data. At the same time, the mobile app is developed using the J**a programming language, which can easily receive and view the recognition results.

OneThe implementation method of license plate recognition.

1. Introduction to the license plate recognition platform

The implementation scheme of this license plate recognition is realized through the intelligent cloud platform, and the specific implementation method is as follows: enter the intelligent cloud web page - > select text recognition - license plate recognition

Once you are on the license plate recognition page, you can learn how to use license plate recognition by reading the technical documentation.

2. Install OpenSSL

Because the intelligent cloud is accessed through HTTPS from libcurl, and HTTPS access needs to be supported by OpenSSL, OpenSSL is compiled first.

wget xvf openssl-1.1.1a.tar.gz./configmakesudo make install
3. Install curl

wget -xjf curl-7.71.1.tar.bz2cd curl-7.71.1/./configure --prefix=$pwd/_install_arm --host=arm-linux-gnueabihf --with-openssl#.configure --prefix=$pwd install gcc --with-openssl In order to run locally, compile with gcc, make make install
4. License plate recognition processBefore doing this step, please read how to use intelligent cloud license plate recognition).

Before the local implementation, it can be verified by the **verification method provided by the platform, as shown in the figure below, you need to enter the access token (you can know how to get it by reading the document) and the base64-encoded string of a license plate next to it for **identification.

The local method of implementing license plate recognition needs to copy the recognition ** to the local computer, and needs to implement a function that converts ** to base64 encoding, the details are as follows:

#include #include #include #include #include #include #include #include #include #include #include inline size_t onwritedata(void * buffer, size_t size, size_t nmemb, void * userp) std::string getfilebase64content(const char * path, bool urlencoded=false) }file_read.close();if(i) if (urlencoded) ret = curl_escape(ret.c_str(),ret.length())return ret;} std::string performcurlrequest(const char *pic_path, const std::string &token) if (curl) curl_easy_cleanup(curl); free(web_curl); return result;} int main(int argc, char *ar**)return 0;}
Compilation

gcc democar.c -i ./curl-7.71.1/_install_gcc/include/ -l ./curl-7.71.1/_install_gcc/lib/ -l curl
After compilation, copy the file to the ELF 1 development board through SCP for running, so that the local license plate** can be sent to the intelligent cloud for recognition through HTTPS, and the recognition result will be returned to complete the license plate recognition.

Note:There may be a CA certificate validation failure when running here.

root@elf1:~# ./a.outok:60
Just run date --s="2024-01-12 21:40:00"Just set the time correctly.

IIPorting mjpg-streamer

In the previous chapter, the recognition of the local license plate ** was realized, so if you need to recognize the license plate through the camera, you need to use the MJPG-streamer to realize it, and the USB camera is used for recognition.

I won't explain what mjpg-streamer is here, you can check the information for yourself, and here is just an introduction to the process of porting mjpg-streamer to the elf 1 development board.

1. Compile jpeg(1) *jpeg source code archive**: ijgorg/files/(2) tar -xvf jpegsrc.v8b.tar.gz(3) to compile the configuration.

cd jpeg-8d./configure --prefix=$pwd/_install --host=arm-linux-gnueabihfmake -j8make install
2. Compile mjpg-streamer1) **mjpg-streamer source code package.

*:sourceforge.net/projects/mjpg-streamer/

svn checkout mjpg-streamer-code
(2)tar -xvf mjpg-streamer.tar.gz(3) configuration.

cd mjpg-streamer-code/mjpg-streamer/plugins/input_uvcvim makefile
Open the makefile file and modify it as shown below

4) Compile mjpg-streamer because mjpg-streamer compiles with gcc by default, so you need to change gcc to your own cross-compilation tool first, and install the libraries you need first.

sudo apt install graphicsmagick-imagemagick-compatsudo apt install imagemagick-6.q16sudo apt install imagemagick-6.q16hdri
There are two ways to change GCC:Method 1:

cd ~/mjpg-streamer-code/mjpg-streamermake cc=arm-linux-gnueabihf-gcc
Method 2:

find -name "makefile" -exec sed -i "s/cc = gcc/cc = arm-linux-gnueabihf-gcc/g" {}grep "arm-linux-gnueabihf-gcc" * nr
Search for all makefile files in the current directory and its subdirectories, and set the cc variable in the makefile to arm-linux-gnueabihf-gcc. (Note:.)arm-linux-gnueabihf-gcc needs to be replaced with its own cross-compilation tool. )

As shown in the figure below, the cc in the makefile in all directories is equal to the cross-compilation tool set.

After doing the above steps, compile **:

make -j8
After the compilation is completed, the following ** will be generated:

so: Dynamic library.

mjpg streamer: provides executable commands.

www: The webpage of the webcam output.

5) Ported to the ELF 1 development board.

scp -r mjpg-streamer/ [email protected]:~
(6) Verification function.

Log in to the ELF 1 board and run the MJPG streamer

cd mjpg-streamerexport ld_library_path=$ld_library_path:~/mjpg-streamer ./mjpg_streamer

When the development board runs the MJPG streamer successfully, enter the IP address and port number 8080 of the development board in the browser, for example, mine is 192168.0.At 106:8080, click on the stream option to display the real-time picture in the camera, as shown in the figure below.

In this way, the porting of the mjpg streamer is completed, and the mjpg streamer can be used to implement some specific requirements, such as turning on the camera**:

mjpg_streamer -i "input_uvc.so -d /dev/video2 -f 30 -q 90 -n" -o "output_http.so -w /opt/www"
Take a screenshot of the camera:

wget -o ./1.jpg
For example, the picture in the camera is a license plate information, which is captured from the real-time picture in the camera to the local area, and then uploaded to the background of the intelligent cloud for recognition, so that the license plate recognition through the camera is completed.

IIIImplementation of the Android app

The implementation of the Android app is very simple, and the main function is to display the successfully recognized license plate number on the app. The specific implementation method is that when the ELF 1 development board successfully recognizes the license plate, it can send the license plate to the Android app through the socket. Since this part** is relatively simple, it is roughly as follows.

1. XML** implementation on the Android side

This part of XML only implements two functions, Button is used to display the prompt of the license plate number, and TextView is used to display the recognized license plate number. 2. Android socket implementation

private handler handler;private textview textview; @overrideprotected void oncreate(bundle s**edinstancestate) new thread(new runnable() catch (ioexception e) }start();
The above paragraph ** implements the license plate data from the development board through the socket and displays it to the textview.

3. ELF 1 development board implementation

The main purpose of the development board is to send the successfully recognized license plate number to the Android APP through the socket, ** as follows:

int main(int argc, char *ar**)struct sockaddr_in serv_addr; serv_addr.sin_family = af_inet; serv_addr.sin_addr.s_addr = inet_addr("192.168.0.104"); serv_addr.sin_port = htons(8374); if (bind(sockfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) 0) return 1; if (listen(sockfd, 5) <0) return 1; struct sockaddr_in cli_addr; socklen_t clilen = sizeof(cli_addr); int newsockfd = accept(sockfd, (struct sockaddr*)&cli_addr, &clilen); if (newsockfd < 0) std::cerr <

Fourth, summary

The identification process of the whole project is shown in the figure below, first run the program, start the camera to run, and then obtain the real-time picture in the camera for identification, and the keywords of the license plate will be retrieved and uploaded to the mobile phone APP after successful recognition, which is the key operation process of the whole project.

All of the above content is provided by the co-creator officer of elfboard, and all shared content is for learning and communication purposes only, and any commercial use is strictly prohibited. )

Related Pages