| 650 | } |
| 651 | |
| 652 | void 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 | |
| 681 | static byte RgbToGray( // CIE conversion to gray using integer arithmetic |
| 682 | const RGBV rgb) |
no test coverage detected