Python cv.CV_CAP_PROP_FRAME_HEIGHT Examples
The following are 5
code examples of cv.CV_CAP_PROP_FRAME_HEIGHT().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
cv
, or try the search function
.
Example #1
Source File: camera_opencv.py From Tickeys-linux with MIT License | 6 votes |
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()
Example #2
Source File: camera_opencv.py From Tickeys-linux with MIT License | 6 votes |
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()
Example #3
Source File: color-1.py From rpi-opencv with GNU General Public License v3.0 | 5 votes |
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')
Example #4
Source File: FPV_client.py From elijah-provisioning with Apache License 2.0 | 5 votes |
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)
Example #5
Source File: download_videos.py From video_to_sequence with BSD 2-Clause "Simplified" License | 4 votes |
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()