It turns out that Excel can change the background color of the ID photo in just three steps!

Author | How about Huang Wei

Source | The Beauty of Data Analysis and Statistics (ID: gh_21c25c7e71d0)

Head picture | CSDN download from Oriental IC

Python completes the ID photo to change the background color

The picture comes from Baidu pictures, if infringement, please contact me to delete! The pictures are only for knowledge exchange.

Not long ago, I wrote an article on how to change the background color of ID photos in Python . I read 20,000+ , commented 102, liked 347, and collected 1808. What's more interesting is that the entire message area has exploded (some screenshots are below), and many people have given their opinions, with mixed reviews .

In fact, what I want to explain is that there may be many solutions to one thing, and this article of mine only provides one way of thinking . You only know that Python can accomplish this before you think about optimizing it in the future, right?

Change the background color of the Python ID photo: http://suo.im/60i6pb

import cv2import numpy as np# 读取照片img=cv2.imread('girl.jpg')
# 图像缩放img = cv2.resize(img,None,fx=0.5,fy=0.5)rows,cols,channels = img.shapeprint(rows,cols,channels)cv2.imshow('img',img)
# 图片转换为灰度图hsv = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)cv2.imshow('hsv',hsv)
# 图片的二值化处理lower_blue=np.array([90,70,70])upper_blue=np.array([110,255,255])mask = cv2.inRange(hsv, lower_blue, upper_blue)

#腐蚀膨胀erode=cv2.erode(mask,None,iterations=1)cv2.imshow('erode',erode)
dilate=cv2.dilate(erode,None,iterations=1)cv2.imshow('dilate',dilate)

# 窗口等待的命令,0表示无限等待cv2.waitKey(0)

This article finally showed that the effect is not so good. It can be seen that the burrs around the outline are not removed very well. Maybe my learning skills are not good. If anyone is interested, you can improve this code. I have provided a link to the original text above.

Excel completes the ID photo to change the background color

Since we are so interested in this skill, I have to find an easy and effective way to change the background color to complete the passport requirement. If Python does not work well, and PS requires a certain foundation, then changing the background color of Excel will be a good choice (the effect is as follows).


It can be seen from the above picture: The effect of changing the background color of the Excel ID photo is still quite good, and there is no burr around the outline.

Not much nonsense, let's go directly to the topic. Take a look at how to change the background color of the ID photo in Excel?

① Import pictures


② Click the picture, and then click Format-->Delete Background

This step has a very critical step. If it is not handled properly, the background of the clothes may be deleted. So we need to mark the area to be reserved .

Note: Keep clicking on the area you want to keep until the clothes appear completely . If you don't do this step, you will get a head portrait, as shown in the figure.

③ Feel free to change the background color you want to replace


After we change the background color of the ID photo, we can make a series of changes to the picture, which is not too cool!


更多精彩推荐
☞感动!盲人计算机科学家研发语音浏览器,致力科技改善盲人生活
☞1024 程序员节重要议程曝光,开源技术英雄会聊开源“真心话”
☞蓝色版苹果iPhone 12开箱上手视频流出;谷歌回应司法部反垄断诉讼:存在严重漏洞;Git 2.29 稳定版发布|极客头条
☞我是一个平平无奇的AI神经元
☞对话阿里云:开源与自研如何共处?
☞10 月中旬的 Medalla 测试网失常:如何开始,将如何结束?
点分享点点赞点在看

Guess you like

Origin blog.csdn.net/csdnsevenn/article/details/109212857