コード例 #1
0
def show_image(window_name, img, wait=False):
    hg.cvStartWindowThread()
    RESIZABLE = 0
    hg.cvNamedWindow(window_name, RESIZABLE)
    hg.cvShowImage(window_name, img)
    if wait:
        print 'show_image: press any key to continue..'
        cv.highgui.cvWaitKey()
コード例 #2
0
    screen.blit(s, loc)


brightness = 1.0
contrast = 1.0
shots = 0

# so, here is the main part of the program

if __name__ == '__main__':

    # a small welcome
    print "OpenCV Python capture video"

    # first, create the necessary window
    highgui.cvStartWindowThread()
    highgui.cvNamedWindow('Camera', highgui.CV_WINDOW_AUTOSIZE)
    highgui.cvStartWindowThread()
    highgui.cvNamedWindow('Color Segmentation', highgui.CV_WINDOW_AUTOSIZE)
    highgui.cvStartWindowThread()
    highgui.cvNamedWindow('Canny', highgui.CV_WINDOW_AUTOSIZE)

    # move the new window to a better place
    highgui.cvMoveWindow('Camera', 10, 10)

    try:
        # try to get the device number from the command line
        device = int(sys.argv[1])

        # got it ! so remove it from the arguments
        del sys.argv[1]
コード例 #3
0
minRadius (Int32)
    Minimal radius of the circles to search for

maxRadius (Int32)
    Maximal radius of the circles to search for. By default the maximal radius is set to max(image_width, image_height). 
"""

import sys, os
from opencv import cv
from opencv import highgui

print "to use: python houghcircles.py imagefile.jpg minRadius maxRadius"

# first, create the necessary window
highgui.cvStartWindowThread()

highgui.cvNamedWindow('GrayScale', highgui.CV_WINDOW_AUTOSIZE)
highgui.cvNamedWindow('Canny', highgui.CV_WINDOW_AUTOSIZE)
highgui.cvNamedWindow('Image Display Window', highgui.CV_WINDOW_AUTOSIZE)

# move the new window to a better place

highgui.cvMoveWindow ('GrayScale', 100, 10)
highgui.cvMoveWindow ('Canny', 200, 10)
highgui.cvMoveWindow ('Image Display Window', 10, 10)

#load image
image = highgui.cvLoadImage(sys.argv[1]);

#create image arrays
コード例 #4
0
ファイル: test_display_pr2_try1.py プロジェクト: wklharry/hrl
    Suggest right-arm valuse are: np.array([0.55,-0.4,1.0]), 0.6, 0.8, 1.3)
    Note, this increases speed by throwing out points outside likely table area.
    It also is meant to remove the 'floor' as a possible candidate for table surface fits. 
'''

pc.truncate_pointcloud_to_voi(np.array([0.55, -0.4, 1.0]), 1, 1, 1.3)
print 'finished truncate_pointcloud in top level function'
#map polygons after translating
''' Visual to quickly check TF
'''
if True:
    print 'overlay_img soon to be obtained'
    overlay_img = pc.draw_mapped_laser_into_image(pc.map, pc.pts3d, pc.img)
    print 'overlay_img obtained'
    import opencv.highgui as hg
    hg.cvStartWindowThread()
    hg.cvNamedWindow('ww', 0)
    hg.cvShowImage('ww', overlay_img)
    print 'wait for key - line 264'
    cv.highgui.cvWaitKey()
print 'finsihed showing mapped_laser image'

if True:
    print 'do polygon mapping'
    pc.do_polygon_mapping()  #-
    ###pc.display_3d('labels')### This is based on accurate polygons.

    print 'map laser into image again'
    pc.img_mapped = pc.draw_mapped_laser_into_image(pc.map, pc.pts3d,
                                                    pc.img)  #-
    #Below: create B & W images corresponding to the artifical 'table edge and center' values we specified.
コード例 #5
0
    It also is meant to remove the 'floor' as a possible candidate for table surface fits. 
'''
  

pc.truncate_pointcloud_to_voi(np.array([0.55,-0.4,1.0]), 1, 1, 1.3)
print 'finished truncate_pointcloud in top level function'
#map polygons after translating 

''' Visual to quickly check TF
'''
if True:
    print 'overlay_img soon to be obtained'
    overlay_img = pc.draw_mapped_laser_into_image(pc.map, pc.pts3d, pc.img)
    print 'overlay_img obtained'
    import opencv.highgui as hg
    hg.cvStartWindowThread()
    hg.cvNamedWindow('ww',0)
    hg.cvShowImage('ww',overlay_img)
    print 'wait for key - line 264'
    cv.highgui.cvWaitKey()
print 'finsihed showing mapped_laser image'

if True:
    print 'do polygon mapping'
    pc.do_polygon_mapping() #-
    ###pc.display_3d('labels')### This is based on accurate polygons.

    print 'map laser into image again'
    pc.img_mapped = pc.draw_mapped_laser_into_image(pc.map, pc.pts3d, pc.img)  #-  
    #Below: create B & W images corresponding to the artifical 'table edge and center' values we specified. 
    #Below: REMOVED DIAGNOSTIC IMAGES. cvPolyLine and cvFillPoly were acting up in opencv 2.0