当前位置: 首页>>代码示例>>Python>>正文


Python cv.CV_CAP_PROP_FRAME_HEIGHT属性代码示例

本文整理汇总了Python中cv.CV_CAP_PROP_FRAME_HEIGHT属性的典型用法代码示例。如果您正苦于以下问题:Python cv.CV_CAP_PROP_FRAME_HEIGHT属性的具体用法?Python cv.CV_CAP_PROP_FRAME_HEIGHT怎么用?Python cv.CV_CAP_PROP_FRAME_HEIGHT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在cv的用法示例。


在下文中一共展示了cv.CV_CAP_PROP_FRAME_HEIGHT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init_camera

# 需要导入模块: import cv [as 别名]
# 或者: from cv import CV_CAP_PROP_FRAME_HEIGHT [as 别名]
def init_camera(self):
        # create the device
        self._device = hg.cvCreateCameraCapture(self._index)

        # Set preferred resolution
        cv.SetCaptureProperty(self._device, cv.CV_CAP_PROP_FRAME_WIDTH,
                              self.resolution[0])
        cv.SetCaptureProperty(self._device, cv.CV_CAP_PROP_FRAME_HEIGHT,
                              self.resolution[1])

        # and get frame to check if it's ok
        frame = hg.cvQueryFrame(self._device)
        # Just set the resolution to the frame we just got, but don't use
        # self.resolution for that as that would cause an infinite recursion
        # with self.init_camera (but slowly as we'd have to always get a
        # frame).
        self._resolution = (int(frame.width), int(frame.height))

        #get fps
        self.fps = cv.GetCaptureProperty(self._device, cv.CV_CAP_PROP_FPS)
        if self.fps <= 0:
            self.fps = 1 / 30.

        if not self.stopped:
            self.start() 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:27,代码来源:camera_opencv.py

示例2: __init__

# 需要导入模块: import cv [as 别名]
# 或者: from cv import CV_CAP_PROP_FRAME_HEIGHT [as 别名]
def __init__(self):
        cv.NamedWindow( color_tracker_window, 1 )
        self.capture = cv.CaptureFromCAM(0)
        width = 640
        height = 480
        cv.SetCaptureProperty(self.capture,cv.CV_CAP_PROP_FRAME_WIDTH,width)
        cv.SetCaptureProperty(self.capture,cv.CV_CAP_PROP_FRAME_HEIGHT,height)
        #self.capture = cv.CaptureFromFile('crash-480.mp4') 
开发者ID:alduxvm,项目名称:rpi-opencv,代码行数:10,代码来源:color-1.py

示例3: FPV_init

# 需要导入模块: import cv [as 别名]
# 或者: from cv import CV_CAP_PROP_FRAME_HEIGHT [as 别名]
def FPV_init():
    global capture
    global latest_frame
    #cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_WIDTH, 640)
    #cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_HEIGHT, 480) 
开发者ID:cmusatyalab,项目名称:elijah-provisioning,代码行数:7,代码来源:FPV_client.py

示例4: download_and_process_video

# 需要导入模块: import cv [as 别名]
# 或者: from cv import CV_CAP_PROP_FRAME_HEIGHT [as 别名]
def download_and_process_video(save_path, row):
    video_id = row['VideoID']
    video_path = row['video_path']
    full_path = os.path.join(save_path, video_path)
    if os.path.exists( full_path ):
        return

    start = row['Start']
    end = row['End']

    print video_id

    if os.path.exists('tmp.mp4'):
        os.system('rm tmp.mp4')

    try: # 다운로드 포기
        youtube = YouTube("https://www.youtube.com/watch?v="+video_id)
    except:
        print "다운로드 포기"
        return

    youtube.set_filename('tmp')

    try: # 360p로 받아보고 안되면 예외처리
        video = youtube.get('mp4', '360p')
    except:
        ipdb.set_trace()
    video.download('.')

    cap = cv2.VideoCapture( 'tmp.mp4' )
    fps = cap.get(cv.CV_CAP_PROP_FPS)
    fourcc = int(cap.get(cv.CV_FOURCC(*'XVID')))
    w = int(cap.get(cv.CV_CAP_PROP_FRAME_WIDTH))
    h = int(cap.get(cv.CV_CAP_PROP_FRAME_HEIGHT))

    out = cv2.VideoWriter( full_path, fourcc, fps, (w,h))

    start_frame = int(fps * start)
    end_frame = int(fps * end)

    frame_count = 0
    while frame_count < end_frame:
        ret, frame = cap.read()
        frame_count += 1

        if frame_count >= start_frame:
            out.write(frame)

    cap.release()
    out.release() 
开发者ID:jazzsaxmafia,项目名称:video_to_sequence,代码行数:52,代码来源:download_videos.py


注:本文中的cv.CV_CAP_PROP_FRAME_HEIGHT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。