2017 National College students Electronic Design Contest B | Cricket Control System (ii) Image algorithm related _ National Electric game

Source: Internet
Author: User

2017 National College students Electronic Design Contest B | Cricket Control System (ii) Image algorithm correlation

Reprint please indicate the source.

I've looked through a lot of existing tutorials and related open source stickers, found that the interpretation of the technology are very vague, the real problem did not explain clearly, the real technology is not reflected, but have to write their own program how powerful, the effect is good, this is contrary to the original intention of open source. When you first pick up the game of the hemispheric system, you will definitely have questions about the visual algorithm and what camera I should use. With what computing platform (MCU or High-performance computing module). What algorithm I use. How do I deal with image noise, uneven exposure, target extraction, positioning, and so on ... Needless to say, I will be in the next post for you to analyze the relevant technical issues as much as possible to solve your doubts.


One, the camera and the main control Panel selection

工欲善其事 its prerequisite, a good camera can bring a huge advantage to the game even the unexpected super buff, or even directly determine whether your game is a country or a reactive return. There were a variety of cameras at the time, and we could be broadly divided into three categories:

1. Fire, Mountain, Lanzeo and other Smart car store hardware two-value camera

2. The camera of the ov2640 and other ov7725 ov7060 to output images in RGB565 format.

3. Support USB interface, pixel is larger than 128x128, frame rate any more than 30fps camera.

Of these, the 1 type of camera has a fast output speed, data simple, SCM processing burden of small advantages, suitable for STM32F1 series Single-chip use, but also has a fatal disadvantage, can not adjust the exposure, easy to appear noise, filtering algorithm difficult, at the same time only black and white information image will cause you can only do small ball positioning, It is difficult to improve the play of the problem. The above disadvantages will directly lead to a big increase in competition difficulty.

The 2 type camera has the image channel integrity, easy to adjust the correlation parameter, may customize the input and output demand the characteristic, but its shortcoming is brings the computation quantity the rise and to the chip computation performance severe test. It is recommended to use the STM32F4 platform to drive the above camera. After testing, F407-driven ov2640 can easily reach 30 frames, plus the algorithm can reach 25~27 frame, basically meet the needs.

The 3 type of camera is dedicated to high-performance computing systems, such as the Raspberry Pie, TX2,TK1,TX1 series, a serious technical cheating program that we will put in the final summary.

Second, the image of the two-value and related issues

First of all here I'm not going to take your hand code binary algorithm, or tell you how the filter code should be written, or tell you how to drive the camera. Because it's a cliché, I'm not teaching you to reinvent the wheel, but to tell you the way and the way to solve the problem. Want the reader to understand.

Since walking the road of vision, we must first binary, binary as a friend of the Smart car know, the main is the threshold of selection and filtering. At the time of the contest, most teams will encounter three problems at the time of the binary.

1. How to choose the threshold value of two values. Different light intensity brings the threshold value is not the same how to do.

2. The image caused by the above 1th problem is noisy.

3. As a result of uneven exposure and thresholds, the small size of the pixel after the second-value of the image is smaller or even disappear. (At the same time the ball in the image Center pixel area will become larger)

Let's look at the first and third questions. Binary threshold values are divided into dynamic thresholds and fixed thresholds, dynamic thresholds need to be relevant algorithm matting, smart cars often used, but sometimes not very stable, especially for beginners can debug a good effect is even more difficult. We can also use the Dajing method commonly used in image processing. Through the Dajing method we can completely solve the first and third problems, and can achieve a near-perfect two-value processing. However, because of the extremely limited computational performance of single chip microcomputer, it is very difficult to operate the Otsu method while guaranteeing smooth control. At the same time, the second problem caused by the impact of the noise is also very fatal, the usual solution is to do median filtering, to remove the salt and pepper noise, which is the noise in our image. However, due to the performance of single-chip microcomputer, it is difficult to design a fast and effective filter in just three days. So, you need to use some stupid method. I am using a fixed threshold + light + matte surface treatment. Fixed thresholds and enhanced LED light complement can solve problems of number 1th and 3rd, by using paint to handle matte black plate surface, we can minimize ambient light interference, reduce noise, clear target. At the same time in the cricket system around the black matte paper, to ensure that the effective pixel area of the camera can cover the entire surface, and the camera vision to achieve complete black, for our next extraction target work to facilitate. The center of the cricket system is to examine your understanding of the control system, and the core part is the closed loop algorithm. So extracting the target is just the necessary matting of the system, but not the most important part. So we need to be as stable and as fast as possible to extract the target, regardless of all means.

Binary image (no filter)


Binary plus simple filter after the image, pay attention to display the screen clear white ball.

Determination of the position of the ball: (stm32f407+ov2640)

With the camera routines on the hot atoms, we can get an array of 16-bit 128x128 sizes.

This array is handled by DMA and scaled by the original image. After two-value, we will get a 128x128 8-bit array, the data contains the black and white information of the image. If your image does not have noise, the ball can be correctly identified, so you can easily determine the location of the ball information. We can search the entire array of all the white pixels of the largest x, y coordinates and the smallest x, y coordinates, respectively, corresponding to the small ball in the image of the top and bottom of the four vertices, through the four vertices of the median to determine the location of the center of Mass. Yes, it's just so simple and convenient. Of course, you can also try Hoffman Circle method, template matching method, as well as FAST-RCNN,SSD to find this circular, the premise is enough computing power, after all F103 processing after the Hoffman Circle algorithm has been stuck into PPT, F4 also not good to where to go.

To this end, the image of the pit has been a simple fill, and finally remind the camera to use a dedicated soft line, or the DuPont line, it is easy to lose frames, lost frame synchronization, field synchronization and other metaphysical problems. We have solved the problem of the input of the cricket system in this issue, and the next phase we will simply pave the way for the control of the steering gear to solve the problem of the output of the cricket system. If there is improper speech or the wrong look, but also hope that a lot of haihan.

Wang Xiangyang Exchange QQ Group 597962412

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.