
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Drawing borders around an image using OpenCV
In this program, we will draw borders around an image. We will use the copyMakeBorder() method in the openCV library. This function takes various parameters like image, top, bottom, left, right border values.
Original Image
Algorithm
Step 1: Import cv2. Step 2: Read the image. Step 3: Dall the cv2.copymakeborder() method. Step 4: Display the output.
Example Code
import cv2 image = cv2.imread('testimage.jpg') image = cv2.copyMakeBorder(image, 10,10,10,10, cv2.BORDER_CONSTANT) cv2.imshow('Border', image)
Output
- Related Questions & Answers
- How to add borders to an image using Java OpenCV library?
- How to fit ellipses around possible objects in an image using OpenCV Java?
- Upsampling an image using OpenCV
- Downsampling an image using OpenCV
- Drawing an image in canvas using in JavaScript
- Draw an ellipse on an image using OpenCV
- Reading an image using Python OpenCv module
- Cartooning an Image using OpenCV in Python?
- Draw rectangle on an image using OpenCV
- Detecting contours in an image using OpenCV
- Performing an opening operation on an image using OpenCV
- Draw a line on an image using OpenCV
- Blurring an image using the OpenCV function blur()
- Eroding an image using the OpenCV function erode()
- Blurring an image using the OpenCV function medianBlur()
Advertisements