• Home
  • About
  • Join Us
  • Contact
Bharat Ideology
  • Insight
  • Culture
  • Economics
  • Parenting
  • Science & Tech
Subscribe
No Result
View All Result
  • Insight
  • Culture
  • Economics
  • Parenting
  • Science & Tech
Subscribe
No Result
View All Result
Bharat Ideology
No Result
View All Result
Home Science & Tech

How to add logo to an image using cv2.bitwise_and() method in OpenCV

by bharatideology
January 10, 2025
in Science & Tech
0
How to add logo to an image using cv2.bitwise_and() method in OpenCV
Share on FacebookShare on Twitter

In this tutorial, we will learn how to add logo to a home image that we have taken in OpenCV. We have two images, first one is Home and second one is Logo and we want to place logo on right side corner of the image.

Logo

Step 1 – Use cv2.IMREAD_COLOR automatically deducts the channel of the image

Related articles

India’s Digital Revolution: A Quantum Leap Towards a $5 Trillion Dream

Top 10 Generative AI Tools and Platforms Reshaping the Future

Step 2- Convert Logo into Gray Scale image using cv2.COLOR_BGR2GRAY, so that we are working on same channel

Step 3- As we want to put logo on top left corner of home image,  we create ROI 

Step 4- Create a mask of the logo by binarization of image and applying that threshold value as mask to home image, also thresh specifies elements of the output array to be changed.

Step 5- When using bitwise_and() in opencv with python then white + anycolor = anycolor; black + anycolor = black. Also roi is added to src1 and scr2 as we don’t want two different images, but RULES defined in mask should be applied

Lets see the source code now-

import cv2
import matplotlib.pyplot as plt
image=cv2.imread("image3.jpg",cv2.IMREAD_COLOR)
logo=cv2.imread("image-3.png",cv2.IMREAD_COLOR)
logo = cv2.cvtColor(logo, cv2.COLOR_BGR2GRAY)
logo = cv2.resize(logo,(0,0),fx = 1.5,fy=1.5)
rows, cols = logo.shape
roi = image[0:rows, 0:cols]
retval, thresh= cv2.threshold(logo,127,255,cv2.THRESH_BINARY)
mask_Image= cv2.bitwise_and(roi, roi, mask = thresh)
image[0:rows, 0:cols] = mask_Image
cv2.imshow('mask_Image', image)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imwrite("mask_Image.jpg",image)

Output of the Image

Tags: Computer Visioncv2Deep LearningOpenCV

bharatideology

Related Posts

India’s Digital Revolution: A Quantum Leap Towards a $5 Trillion Dream

India’s Digital Revolution: A Quantum Leap Towards a $5 Trillion Dream

by bharatideology
February 17, 2024
0

The year is 2024, and India stands at a crossroads. The ghosts of the "fragile five" label still linger in the collective memory, but a new...

Top 10 Generative AI Tools and Platforms Reshaping the Future

Top 10 Generative AI Tools and Platforms Reshaping the Future

by bharatideology
January 9, 2025
0

Generative AI, the technology that conjures new ideas and content from thin air, is taking the world by storm. From crafting captivating images to writing eloquent...

Decoding the Future: Gen AI’s Evolution in 2024 – Trends, Strategies, and Business Impact

Decoding the Future: Gen AI’s Evolution in 2024 – Trends, Strategies, and Business Impact

by bharatideology
January 9, 2025
0

Introduction The past year has witnessed an explosive eruption in the realm of Generative AI (Gen AI), propelling it from a nascent technology to a pivotal...

Will Gemini be the AI to Rule Them All? Exploring the Rise of Google’s Multimodal Colossus

Will Gemini be the AI to Rule Them All? Exploring the Rise of Google’s Multimodal Colossus

by bharatideology
January 9, 2025
0

The landscape of Large Language Models (LLMs) has witnessed a rapid evolution, with Google playing a pivotal role in pushing boundaries. Enter Gemini, Google's latest LLM,...

GenAI, LLMs, and Vector Databases: Revolutionizing Recommendation Systems in 2024

GenAI, LLMs, and Vector Databases: Revolutionizing Recommendation Systems in 2024

by bharatideology
January 9, 2025
0

Overview The world of recommendation systems is undergoing a paradigm shift, propelled by the convergence of Generative AI (GenAI) and Large Language Models (LLMs). These powerful...

CATEGORIES

  • Culture
  • Economics
  • Insight
  • Parenting
  • Science & Tech

RECOMMENDED

Millets: The New Superfood on the 5-Star Menu
Culture

Millets: The New Superfood on the 5-Star Menu

August 1, 2023
Robotics and AI: The Skills Kids Need to Succeed in the 21st Century
Parenting

Robotics and AI: The Skills Kids Need to Succeed in the 21st Century

August 2, 2023

Twitter Handle

TAGS

Agnipath Ambedkar Panchteerth Artificial Intelligence Ayodhya Ayushman Bharat Backpropogation Bhagwan Birsa Munda Museum CNN CNN Architecture Co-win Computer Vision Consecration Deep Learning Digital India Digital Revolution FutureSkills PRIME GenAI Hornbill Festival Image Segmentation International Space Station LLM Make in India Namami Gange Narendra Modi Neural Network Object Detection OCR OpenCV PLI PM Modi PRASHAD Python Ramayana Ram Mandir Recurrent Neural Network RNN Sangai Festival Semiconductor Shri Ram Janambhoomi Temple Skill India Statue of Unity Swadesh Darshan Tensorflow Vaccine Maitri Women empowerement
Bharat Ideology

Do not be led by others,
awaken your own mind,
amass your own experience,
and decide for yourself your own path - Atharv Ved

© Copyright Bharat Ideology 2023

  • About
  • Disclaimer
  • Terms & Conditions
  • Contact
No Result
View All Result
  • About
  • Contact
  • Disclaimer
  • Home
  • Terms and Conditions of use

© Copyright Bharat Ideology 2023