MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / ImgPrintf

Function ImgPrintf

jni/stasm/misc.cpp:652–679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

650}
651
652void ImgPrintf( // printf on image
653 CImage& img, // io
654 double x, // in
655 double y, // in
656 unsigned color, // in: rrggbb e.g. 0xff0000 is red
657 double size, // in: relative font size, 1 is standard size
658 const char* format, // in
659 ...) // in
660{
661 char s[SBIG]; // format format into s
662 va_list args;
663 va_start(args, format);
664 VSPRINTF(s, format, args);
665 va_end(args);
666
667 CV_Assert(size > 0);
668 double fontsize = size * MIN(img.cols, img.rows) / 1000.;
669 if (fontsize < .3) // smaller than about .3 is not legible
670 fontsize = .3;
671
672 // make the letters thick enough to be seen on high pixel images,
673 // but not too thick to be illegible. The code below sorta works.
674
675 int thickness = MAX(1, cvRound(img.rows > 1000? 2 * fontsize: fontsize));
676
677 putText(img, s, cv::Point(cvRound(x), cvRound(y)),
678 CV_FONT_HERSHEY_SIMPLEX, fontsize, ToCvColor(color), thickness);
679}
680
681static byte RgbToGray( // CIE conversion to gray using integer arithmetic
682 const RGBV rgb)

Callers 3

TraceEyeMouthImgFunction · 0.85
TraceShapeFunction · 0.85
TraceFacesFunction · 0.85

Calls 1

ToCvColorFunction · 0.85

Tested by

no test coverage detected