Skip to content

Commit d11e20a

Browse files
Merge pull request prathimacode-hub#978 from Umesh-01/patch-9
Change image background
2 parents 4a7d92c + 5842676 commit d11e20a

File tree

6 files changed

+389
-0
lines changed

6 files changed

+389
-0
lines changed
20.7 KB
Loading
2.14 MB
Loading
4.72 MB
Loading
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Change Image Background
2+
3+
#### AIM:
4+
We will build a project that can help us in changing the background of any image without using any image editor like Photoshop, etc. This project can be done with the help of some libraries using Python programming.
5+
6+
7+
#### PURPOSE:
8+
9+
In this project we will be changing the background of image with the help of some libraries using Python programming.
10+
11+
#### DESCRIPTION:
12+
The details of python libraries and how they are working is here-
13+
14+
**LIBRARIES USED**
15+
- **Numpy:** `numpy` forms the basis of powerful machine learning libraries like scikit-learn and SciPy. As machine learning grows, so does the list of libraries built on `numpy`. TensorFlow’s deep learning capabilities have broad applications — among them speech and image recognition, text-based applications, time-series analysis, and video detection. PyTorch, another deep learning library, is popular among researchers in computer vision and natural language processing.
16+
17+
- **OpenCV:** `opencv` is a library of programming functions mainly aimed at real-time computer vision. Originally developed by Intel, it was later supported by Willow Garage then Itseez. The library is cross-platform and free for use under the open-source Apache 2 License.
18+
19+
- **Matplotlib:** `matplotlib` is a plotting library for the Python programming language and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits like Tkinter, wxPython, Qt, or GTK.
20+
21+
#### INSTALLATION:
22+
Install the following libraries using `pip` command in any terminal
23+
24+
```python
25+
pip install numpy
26+
pip install opencv-python
27+
pip install matplotlib
28+
```
29+
#### WORKFLOW:
30+
31+
1. We are importing the required libraries
32+
2. Reading the image as per our choice
33+
3. Then applying mask on the image
34+
4. Resizing the image, so that both the images can be of same size
35+
5. Now with the help of and operation combining the masked image with background image
36+
6. After that displaying and saving the final image
37+
38+
#### USAGE:
39+
40+
To start using this project, follow the below guidelines:
41+
42+
**1.** Fork this project/repository.
43+
44+
**2.** Clone your forked copy of the project/repository.
45+
46+
```
47+
git clone https://github.com/<your-github-username>/Awesome_Python_Scripts.git
48+
```
49+
50+
**3.** Navigate to the project directory.
51+
52+
```
53+
cd Awesome_Python_Scripts/Change Image Background/
54+
```
55+
56+
**4.** Install the `requirements.txt` using the given command.
57+
58+
```
59+
pip install -r requirements.txt
60+
```
61+
62+
**5.** Run `Change Image Background.ipynb` file in Google Colab or Jupyter Notebook or any other platform.
63+
64+
#### CONCLUSION:
65+
We have created a project for changing the background of an image. And we have also learnt how to make such type of project for changing image background, the output we got with this project is also attached here.
66+
67+
#### SCREENSHOTS:
68+
69+
**1. Sample image for any Object**
70+
<div align="center">
71+
72+
<img width="700" height="450" src="../Change%20Image%20Background/Images/Asus%20rog%20logo.jpg">
73+
</div>
74+
75+
**2. Image for Background**
76+
<div align="center">
77+
78+
<img width="700" height="450" src="../Change%20Image%20Background/Images/black wood Background.jpg">
79+
</div>
80+
81+
**3. Final Output**
82+
<div align="center">
83+
84+
<img width="700" height="450" src="../Change%20Image%20Background/Images/Final_image.png">
85+
</div>
86+
87+
88+
### Contributor
89+
<a href="https://github.com/Umesh-01">Umesh Singh</a>

ImageProcessingScripts/Change Image Background/change_image_background.ipynb

Lines changed: 297 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
opencv-python==4.5.2.54
2+
matplotlib==3.4.2
3+
numpy==1.21.0

0 commit comments

Comments
 (0)