As shown in the image I want to resize and scale the roi. I have the coordinates of ROI. Can someone help me to achieve this using python and opencv?
I am following this article if you scroll down you'll see a similar image and the author has tried explaining what he has done but I am unable to implement it.
Thanks
I have taken 4 variations of the image which are the original, halved, big and stretched.
Here you go:
import cv2
import matplotlib.pyplot as plt
import numpy as np
image = cv2.imread("<your image>", 1)
half = cv2.resize(image, (0, 0), fx = 0.1, fy = 0.1)
bigger = cv2.resize(image, (1050, 1610))
stretch_near = cv2.resize(image, (780, 540),
interpolation = cv2.INTER_NEAREST)
Titles =["Original", "Bigger", "Half", "Stretched"]
images =[image, bigger, half, stretch_near]
for i in range(len(titles)):
plt.subplot(2, 2, i + 1)
plt.title(Titles[i])
plt.imshow(images[i])
plt.show()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.