How to find correct Region of interest for different dpi images?

asked 2017-01-18 23:12:15 -0600

Rashmi gravatar image

I am developing commercial software for reading images and finding region of interest by passing top left corner coordinates and bottom right coordinates of rectangle then crop the image.Some client provides samples like 100 dpi, 200 dpi or 400 dpi images of same image. Because these kind of images, my coordinates lie somewhere else. How can i fix a problem to find actual area of interest for different dpi of images and find exact ROI? Give some rough idea to solve it.

first = [1025,1000]
last = [1550,1400]
image = cv2.imread("db/SGBAU/pink OMR/200.jpg")
def ROI_extract(first_corner,last_corner,image):
#croping ROI
ROI_img = image[first_corner[1]:last_corner[1],first_corner[0]:last_corner[0]]
cv2.imwrite(os.path.join('db/','ROI.png'), ROI_img)
return ROI_img
edit retag flag offensive close merge delete

Comments

1

DPI=Dot Per Inch. For images means Pixel Per Inch thus If DPI double, your ROI (coordinates and size) should double too.

Or, if your ROI is referring to well know position in the paper, assuming that DPIx=DPIy, you could use relative coordinates than calculate absolute value for each input image.

pklab gravatar imagepklab ( 2017-01-22 09:41:59 -0600 )edit