(self)
Reads the next frame from the image directory.
		
		Keyword Arguments
		
		Returns
		
		success, frame	-	success is a Boolean that indicates whether
						a frame could be obtained.
						frame is a numpy.ndarray with unsigned,
						8-bit integers that reflect the greyscale
						values of the image. If no frame could be
						obtained, None will be returned.
Reads the next frame from the image directory.
		
		Keyword Arguments
		
		Returns
		
		success, frame	-	success is a Boolean that indicates whether
						a frame could be obtained.
						frame is a numpy.ndarray with unsigned,
						8-bit integers that reflect the greyscale
						values of the image. If no frame could be
						obtained, None will be returned.
Reads the next frame from the image directory . Keyword Arguments Returns success frame - success is a Boolean that indicates whether a frame could be obtained . frame is a numpy . ndarray with unsigned 8 - bit integers that reflect the greyscale values of the image . If no frame could be obtained None will be returned .
def _get_frame(self):
		
		"""Reads the next frame from the image directory.
		
		Keyword Arguments
		
		Returns
		
		success, frame	-	success is a Boolean that indicates whether
						a frame could be obtained.
						frame is a numpy.ndarray with unsigned,
						8-bit integers that reflect the greyscale
						values of the image. If no frame could be
						obtained, None will be returned.
		"""
		
		# Check if there is a next image. If there isn't, disconnect.
		if self._framenr >= self._nframes:
			ret = False
			self._connected = False
		# Load the next image.
		else:
			# Construct the path to the current image.
			framepath = os.path.join(self._imgdir, \
				self._framenames[self._framenr])
			# Use OpenCV to load the image. This will return a numerical
			# representation of the image in BGR format. It can also
			# return None if imread fails.
			frame = cv2.imread(framepath)
			# If no image was read, set the return value to False. If
			# an image was loaded, the return value should be True, which
			# will allow further processing.
			if frame is None:
				ret = False
			else:
				ret = True
			# Increase the frame counter by one, so that next time this
			# function is called, the next image will be loaded.
			self._framenr += 1
		
		# If a new frame was available, proceed to process and return it.		
		if ret:
			# Return the red component of the obtained frame.
			if self._mode == 'R':
				return ret, frame[:,:,2]
			# Return the green component of the obtained frame.
			elif self._mode == 'G':
				return ret, frame[:,:,1]
			# Return the blue component of the obtained frame.
			elif self._mode == 'B':
				return ret, frame[:,:,0]
			# Convert to grey.
			elif self._mode == 'RGB':
				return ret, cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
			# Throw an exception if the mode can't be recognised.
			else:
				_message(u'error', u'webcam.WebCamTracker._get_frame', \
					u"Mode '%s' not recognised. Supported modes: 'R', 'G', 'B', or 'RGB'." \
					% (self._mode))
		
		# If a new frame wasn't available, return None.
		else:
			return ret, None
def _get_frame ( self ) : # Check if there is a next image. If there isn't, disconnect. if self . _framenr >= self . _nframes : ret = False self . _connected = False # Load the next image. else : # Construct the path to the current image. framepath = os . path . join ( self . _imgdir , self . _framenames [ self . _framenr ] ) # Use OpenCV to load the image. This will return a numerical # representation of the image in BGR format. It can also # return None if imread fails. frame = cv2 . imread ( framepath ) # If no image was read, set the return value to False. If # an image was loaded, the return value should be True, which # will allow further processing. if frame is None : ret = False else : ret = True # Increase the frame counter by one, so that next time this # function is called, the next image will be loaded. self . _framenr += 1 # If a new frame was available, proceed to process and return it.		 if ret : # Return the red component of the obtained frame. if self . _mode == 'R' : return ret , frame [ : , : , 2 ] # Return the green component of the obtained frame. elif self . _mode == 'G' : return ret , frame [ : , : , 1 ] # Return the blue component of the obtained frame. elif self . _mode == 'B' : return ret , frame [ : , : , 0 ] # Convert to grey. elif self . _mode == 'RGB' : return ret , cv2 . cvtColor ( frame , cv2 . COLOR_BGR2GRAY ) # Throw an exception if the mode can't be recognised. else : _message ( u'error' , u'webcam.WebCamTracker._get_frame' , u"Mode '%s' not recognised. Supported modes: 'R', 'G', 'B', or 'RGB'." % ( self . _mode ) ) # If a new frame wasn't available, return None. else : return ret , None