Question: I need to modify current code that I have in cv 2 need to rotate image that is in the center by 3 6 0

I need to modify current code that I have in cv2
need to rotate image that is in the center by 360 degrees
CAN NOT USE BUILD IN FUNCTIONS
NEED TO WRITE OUT THE CODE
A function for multiplying two arbitrary nxm matrices
(n and m should be dynamic)
using the matrix multiplication function
when you rotate the image by 45 degrees for example, the corners can't be clipped
import cv2
import numpy as np
image1=cv2.imread("apple.png")
numRows=image1.shape[0]
numCols=image1.shape[1]
#shiftRows =(heightOfEmptyImage - heightOfImage1)/2
num3=2
emptyIm=np.zeros((numRows*num3, numCols*num3,3), np.float32)
shiftrows=int(((numRows*num3-numRows)/2))
shiftcol=int(((numCols*num3-numCols)/2))
for i in range(numRows):
for j in range(numCols):
emptyIm[int(i+shiftrows)][int(j+shiftcol)][0]=image1[i][j][0]
emptyIm[int(i+shiftrows)][int(j+shiftcol)][1]=image1[i][j][1]
emptyIm[int(i+shiftrows)][int(j+shiftcol)][2]=image1[i][j][2]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!