Skip to content

Instantly share code, notes, and snippets.

@yptheangel
Last active October 21, 2019 09:20
Show Gist options
  • Save yptheangel/9cbdce42775afd1fe7a28a9e9c98a0e9 to your computer and use it in GitHub Desktop.
Save yptheangel/9cbdce42775afd1fe7a28a9e9c98a0e9 to your computer and use it in GitHub Desktop.
draw_text_with_background_opencv
int baseline[]={0};
Size textSize=getTextSize("Hello World", FONT_HERSHEY_DUPLEX, 1,1,baseline);
int textwidth=textSize.get(0);
int textheight=textSize.get(1);
rectangle(yourMat, new Point(x1 + 2, y2 - 2), new Point(x1 + 2+textwidth, y2 - 2-textheight),RGB(255,255,0), FILLED,0,0);
putText(yourMat, "Hello World", new Point(x1 + 2, y2 - 2), FONT_HERSHEY_DUPLEX, 1, RGB(0,0,0));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment