All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Objective : Perform a One of the image manipulation of the image (Rotation) Library Used : Opencv numpy Image manipulation are useful for algorithms , manipulating the image as required for the algorithms. Capturing the required part of the image. About in-built Functions : cv2.getRotationMatrix2D((col_cen,row_cen),…
Epuri Yoga Narasimha
updated on 10 Aug 2021
Objective : Perform a One of the image manipulation of the image (Rotation)
Library Used :
Image manipulation are useful for algorithms , manipulating the image as required for the algorithms.
Capturing the required part of the image.
About in-built Functions :
1. col_cen, row_cen -> co-ordinates of the pixel , rotate the image with respect to the center point as provided.
2. angle -> Amount of an angle to rotate the image
(+ve) -> Anticlockwise Direction.
(-ve) -> Clockwise Direction.
3. Scale -> Factor by which the image to get scaled up or scaled down.
Use this function we get the matrix , contain the rotation behaviour.
1. image -> on which image we want to perform the Transformation.
2. M-> Transformation Matrix.
3. dsize -> Size of the output image.
4. flags -> Interpolation Method
Applies the transformation Matrix on the image
Some other functions used :
Image Manipulations :
Code Snippet :
def image_rotation(image, dimensions=None, angle=None, scale=None, center=None):
rows,cols = image.shape
if center == None:
col_cen = cols/2
row_cen = rows/2
else:
col_cen = center[1]
row_cen = center[0]
rotation_matrix = cv2.getRotationMatrix2D((col_cen, row_cen), angle, scale)
rotated_image = cv2.warpAffine(image, rotation_matrix, (image.shape[1],
image.shape[0]))
cv2.putText(rotated_image, text='Roatated Image using opencv',
org=(100,200),
fontFace= cv2.FONT_HERSHEY_SIMPLEX,
fontScale=2, color=(255,0,0),
thickness=5, lineType=cv2.LINE_AA)
return rotated_image
Function calling :
# center = (row, column)
# angle = +ve(ACW), -ve(CW)
# scale = Factor
angle = 30
scale = 0.5
rotated_image = image_rotation(image, angle = angle, scale = scale)
display_image('rotated_image', rotated_image)
df = cv2.vconcat([image,rotated_image])
save_image('rotated_image1.JPG',df)
Explanation :
1. Prepare the rotation matrix using the getRotationMatrix2D().
2. Then perform the affine (or) Matrix Transformation on the image.
Manipulated Image :
Here considered the parameters as ACW rotation, 0.5 factor shrinking, image size as the original image
.
Conclusion:
Performed the Rotation operation on the image in both anticlockwise and the clockwise direction.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Project 4
Objective 1. Detect lanes using Hough Transform Method. Steps in lane Detection 1. Detect Edges using Canny Edge Detection Method. 2. Capture the Region of Interest in Image. 3. Detect lines using Hough Transform. 4. Calculate the actual left and right lanes from all lines. 6. Find the coordinates of the lines. 7. Display…
21 Feb 2023 05:22 AM IST
Lane Detection using Hough Transform
Objective 1. Detect lanes using Hough Transform Method. Steps in lane Detection 1. Detect Edges using Canny Edge Detection Method. 2. Capture the Region of Interest in Image. 3. Detect lines using Hough Transform. 4. Calculate the actual left and right lanes from all lines. 6. Find the coordinates of the lines. 7. Display…
21 Feb 2023 05:20 AM IST
Edge Detection and Hough Transform
Objective: Detecting Edges using Canny Edge Detector. Understand and display the outputs of all steps in the canny Edge Detection process. Effect on the output on changing the parameters of the Non-Maximum Suppression. Understand Hough Transform and Lane Detection using Hough Transform. Steps Follow in the Discussion:…
28 Dec 2022 09:58 PM IST
week 2 : Image Filtering
Objective: Apply Prewitt and Laplacian filter on the image Libraries used: Opencv Open Source computer vision library. cross-platform supported. can perform through c, c++, and python. numpy Mathematical library to work in the domain of Linear algebra, Fourier transform, and matrices. Image Filtering…
09 Jul 2022 06:36 AM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.