Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago