In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use OpenCV in C++ to achieve the function of changing blue background to white background, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
The main steps are:
1. Convert RGB image to HSV space
two。 Take a small piece of the background 20 to 20 to calculate the average hue and saturation of the blue background.
3. Set the threshold and replace the blue background with the red background
4. Convert HSV image to RGB space
5. Filter to remove edge effect
The specific code is:
/ / change_color.cpp: defines the entry point for the console application. / / change the ID photo from blue background to red background / / # include "stdafx.h" # include # include using namespace cv;using namespace std;int main () {char * origin= "Original"; char * window= "Image"; char * str= "C:\\ Users\\ ltc\\ Desktop\ nihao.jpg"; namedWindow (origin,1); namedWindow (window,1); Mat image=imread (str); if (! image.data) {cout
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.