In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "OpenCV how to achieve cat face detection", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "OpenCV how to achieve cat face detection" this article.
OpenCV
OpenCV is the most popular open source computer vision library based on C++. It has rich functions and functions, ranging from the most basic reading and writing pictures, to simple image processing (such as noise reduction filtering, edge detection, image transformation, feature extraction, etc.), to more advanced pedestrian detection, face recognition, text recognition, etc. On the basis of the functions provided by OpenCV, we can easily develop our own applications and implement our own algorithms. In general, OpenCV is very powerful. How powerful is it exactly? We won't know until we use it.
A question asked by many people who want to do face recognition and use SIFT features is: after configuring opencv, why can't you find the header file for face recognition and where is SIFT?
This is because after OpenCV3.0, something that is still up-to-date, but not very stable, is still in the testing phase is put into the contrib module. And the official default does not have the contrib module. Unfortunately, the facial recognition and SIFT features we most want to use are in contrib.
If you need to use it, you need to compile it yourself. You can refer to my previous blog for how to configure opencv on Visual Studio and how to compile contrib. Today's content is still in Python, and it's easier to use Python recently.
Python environment configuration for OpenCV
Obviously, like many C++-based libraries, OpenCV also has a Python interface. You can configure OpenCV under Python in the following two ways:
After downloading and installing OpenCV on the official website, there is a cv2.pyd file in the directory\ opencv\ build\ python\ 2.7\ x64. Copy it to the\ Lib\ site-packages folder in the python installation directory. It is important to note that the version corresponds, for example, to the 64-bit Python2.7. And at present, only the Python2.7 version of the package is officially available. What if you want another version?
Let's talk about a magical website: Unofficial Windows Binaries for Python Extension Packages, which contains almost all the installation packages of Python libraries that can be used, such as the OpenCV we need. Here you can find so many versions that can be adapted to different needs, as well as compiled contrib versions, which is a pleasant surprise.
Download the appropriate version according to your own environment, and then install it with pip, with the following command:
Pip install * .whl
Please change the asterisk to the corresponding name.
I am using a 64-bit package of Python3.6 that contains contrib.
Cat face detection
Cats are really going to rule the world. Otherwise, why OpenCV's own detector in addition to face detection, pedestrian detection, which should be expected to exist, but also quietly more cat face detector?
Today, let's try what this cat face test looks like. Cat face detection based on OpenCV is very simple. With Python, there are only 20 lines of code. Only one function plays a major role in 20 lines of code:
DetectMultiScale ()
The purpose of this function is to detect objects of different sizes in the input image and return a rectangle containing the object. The parameters it receives:
1.imageWhile-enter the image
2. ScaleFactormusic-indicates the percentage of gear reduction in each round of inspection image
3.minNeighborsMurray-indicates how many times an object must be detected before it can be determined that it does exist.
4.minSizeWhile-the minimum size of the detected object
5.maxSizemuri-the maximum size of the detected object
Code
According to the usual practice, the notes are complete and needless to say.
Effect.
The effect of running the Python script is as follows:
The above is all the contents of the article "how to achieve Cat face Detection in OpenCV". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.