Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

Question about resizing and cropping

$
0
0
https://snag.gy/DOdZBc.jpg First: I have an image that I want to adjust the resolution of to a set resolution with a desired scale to ratio around the head.. currently i have this going widthO, heightO = image.shape[:2] ## original width and height image = cv2.resize(image,(2170, 2894), interpolation = cv2.INTER_AREA) new_dimensionX = heightO * 631 / ((pointOfEight) - (pointOfInterestX)) new_dimensionY = widthO * 631 / ((pointOfEight) - (pointOfInterestX )) image = cv2.resize(image,(int(new_dimensionX), int(new_dimensionY)) I need the head to be with the height of 631. I'd like to maintain the 2170,2894 size on the last calculation. Any help? Also, on that note. Once that occurs, I can calculate those three dots. And I want to center the image based on the middle dot such that the nose will have a straight line going vertically through it at the center. This is my attempt: Rx = new_dimensionX / heightO Ry = new_dimensionY / widthO crop_img = crop_img[0:2894, int((pointOfNose - 2170/2) * Ry):int(pointOfNose + 2170/2 * Ry)]

Viewing all articles
Browse latest Browse all 2088

Trending Articles