Want to resize roi by 1.5 within the original image size 128*128

asked 2020-07-02 07:08:31 -0500

Malathi_72 gravatar image
def fresize(image):
h = image.shape[0]
w = image.shape[1]

center_x = int(w/2)
center_y = int(h/2)

roi = image[center_y-60:center_y+60,center_x-60:center_x+60].copy() 
roi_h = roi.shape[0]
roi_w = roi.shape[1]

resize_roi = cv2.resize(roi,(int(roi_w*1.5),int(roi_h*1.5)))  
cropped_img = resize_roi.crop(((w-128)//2, (h-128)//2, (w+128)//2, (h+128)//2))
image[center_y-60:center_y+60,center_x-60:center_x+60] = 255    
image=cropped_img
edit retag flag offensive close merge delete

Comments

and the problem is ?

berak gravatar imageberak ( 2020-07-02 07:17:08 -0500 )edit

image shape mismatch. Original shape not retained

Malathi_72 gravatar imageMalathi_72 ( 2020-07-02 10:19:37 -0500 )edit

that's not an opencv error msg

whole stacktrace, please

berak gravatar imageberak ( 2020-07-02 11:33:33 -0500 )edit

Please suggest alternate solution for the problem stated

Malathi_72 gravatar imageMalathi_72 ( 2020-07-02 21:03:02 -0500 )edit