May 29, 2021 Article blog
Automated coding of these logos requires two steps:
First, let's look at how to identify brand logos in an image. The recognition here we use Baidu AI recently more popular image recognition application - brand logo recognition.
As you can see, this app recognizes more than 20,000 logos, including logos from some of our most common clothing brands. For image logo recognition, the program is shown in the following image:
The program first reads through the picture in binary mode, encodes base64, then submits the picture and access_token token information to the specified URL, and then returns the logo information, including the logo's brand name and the logo's location in the picture. As shown in the following image:
With the coordinate information for the logo, the next step is to code the logo in the picture, and the code program looks like this:
In the above program, first read into the original picture and get the length and width of the picture, and then for the logo area in the picture, according to the pixel value of the logo area are added to the upper-left pixel value of the logo area, the logo area for coding processing, and finally save the coded picture to the local.
Because there may be more than one logo area in a picture, you need to code all the logo areas in a picture through a for loop.
Finally, let's take a look at the final results of the code, as shown in the following image.
As you can see, the operation of the logo can be done well by running the program. However, in the process of logo recognition, the presence of light, logo shape changes and occlusion, there may also be logo misdirection and inadequate identification, think of the results in the figure below.
As you can see, the logo in the middle is obscured in the results shown above, resulting in the identification of results and positions that are not particularly accurate, but the logo processing in the upper left corner is excellent.
The above is the small editor today for you to bring small sharing, through the simple fifty-line program processing, you can automatically for the logo mosaic processing. Let's try the effect ourselves and "resist" these clothing brands.
Reprinted from: Rookie Python