Пример #1
0
                              random.randrange (0, 100) * 0.05 + 0.01,
                              random.randrange (0, 5) * 0.1,
                              random.randrange (0, 10),
                              line_type)

        cv.cvPutText (image, "Testing text rendering!",
                      pt1, font,
                      random_color (random))
        
        highgui.cvShowImage (window_name, image)
        highgui.cvWaitKey (delay)

    # prepare a text, and get it's properties
    font = cv.cvInitFont (cv.CV_FONT_HERSHEY_COMPLEX,
                          3, 3, 0.0, 5, line_type)
    text_size, ymin = cv.cvGetTextSize ("OpenCV forever!", font)
    pt1.x = (width - text_size.width) / 2
    pt1.y = (height + text_size.height) / 2
    image2 = cv.cvCloneImage(image)

    # now, draw some OpenCV pub ;-)
    for i in range (255):
        cv.cvSubS (image2, cv.cvScalarAll (i), image, None)
        cv.cvPutText (image, "OpenCV forever!",
                      pt1, font, cv.cvScalar (255, i, i))
        highgui.cvShowImage (window_name, image)
        highgui.cvWaitKey (delay)

    # wait some key to end
    highgui.cvWaitKey (0)
Пример #2
0
                              random.randrange (0, 100) * 0.05 + 0.01,
                              random.randrange (0, 5) * 0.1,
                              random.randrange (0, 10),
                              line_type)

        cv.cvPutText (image, "Testing text rendering!",
                      pt1, font,
                      random_color (random))
        
        highgui.cvShowImage (window_name, image)
        highgui.cvWaitKey (delay)

    # prepare a text, and get it's properties
    font = cv.cvInitFont (cv.CV_FONT_HERSHEY_COMPLEX,
                          3, 3, 0.0, 5, line_type)
    text_size, ymin = cv.cvGetTextSize ("OpenCV forever!", font)
    pt1.x = (width - text_size.width) / 2
    pt1.y = (height + text_size.height) / 2
    image2 = cv.cvCloneImage(image)

    # now, draw some OpenCV pub ;-)
    for i in range (255):
        cv.cvSubS (image2, cv.cvScalarAll (i), image, None)
        cv.cvPutText (image, "OpenCV forever!",
                      pt1, font, cv.cvScalar (255, i, i))
        highgui.cvShowImage (window_name, image)
        highgui.cvWaitKey (delay)

    # wait some key to end
    highgui.cvWaitKey (0)