Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

DPI are used to print, scan or display ... from/to real world. DPI is a scale factor to convert inches coordinates into pixel coordinates and back.

OpenCV doesn't know about DPI it just uses matrix cols and rows as pixel coordinates x,y. If you have coordinates in inches and you know source DPI you can convert them in rows and cols:

x_px = x_inch * DPI
y_px = y_inch * DPI

Remember that in OpenCV

  • 0,0 is top left
  • X are columns and increases on the right
  • Y are rows and increases on the bottom