Example #1
0
    def process(self):
        """Process frames in queue/memory."""
        # Start benchmark
        self.bench.start("Processing", len(self.files))
        # Temporary Data Var
        data = []

        # Initialize Compare Object
        if METHOD == algorithm.BACKGROUND_SUBTRACTION:
            # Load Current Frame and Background
            compare = CompareImages(self.queue[0], background)
        elif METHOD == algorithm.FRAME_DIFFERENCING:
            # Load Current Frame and Next Frame
            compare = CompareImages(self.queue[0], self.queue[1])

        # Process Image Queue
        for frame in self.queue:
            if METHOD == algorithm.BACKGROUND_SUBTRACTION:
                # Load Current Frame
                compare.setLeft(frame)
            elif METHOD == algorithm.FRAME_DIFFERENCING:
                # Load Next Frame
                compare.setRight(frame)
            data.append(compare.process(TOLERANCE))

        # End benchmark
        self.bench.end()
        # Write data to file
        listToFile(data, 'data.txt')
Example #2
0
	def process(self):
		"""Process frames in queue/memory."""
		# Start benchmark
		self.bench.start("Processing", len(self.files))
		# Temporary Data Var
		data = []

		# Initialize Compare Object
		if METHOD == algorithm.BACKGROUND_SUBTRACTION:
			# Load Current Frame and Background
			compare = CompareImages( self.queue[0], background )
		elif METHOD == algorithm.FRAME_DIFFERENCING:
			# Load Current Frame and Next Frame
			compare = CompareImages( self.queue[0], self.queue[1] )

		# Process Image Queue
		for frame in self.queue:
			if METHOD == algorithm.BACKGROUND_SUBTRACTION:
				# Load Current Frame
				compare.setLeft( frame )
			elif METHOD == algorithm.FRAME_DIFFERENCING:
				# Load Next Frame
				compare.setRight( frame )
			data.append( compare.process( TOLERANCE ) )

		# End benchmark
		self.bench.end()
		# Write data to file
		listToFile(data, 'data.txt')
Example #3
0
currentFile = 0
processedFile = -1

# Display Vars
showSource = False
showBound = True
showBoundCenter = True

# Game Loop Sentinel
notDone = True
refresh = False

# Initialize Compare Object
if METHOD == algorithm.BACKGROUND_SUBTRACTION:
	# Load Current Frame and Background
	compare = CompareImages( ImageFile(files[0], 0), background )
elif METHOD == algorithm.FRAME_DIFFERENCING:
	# Load Current Frame and Next Frame, currentFile
	compare = CompareImages( ImageFile(files[0], 0), ImageFile(files[1], 1) )

# Main Game Loop
while notDone:
	# Fill Display with Black
	screen.fill(BLACK)

	# Redraw. Switch Between Source Image Surface, and Diffed Image.
	if refresh:
		# Reset Refresh
		refresh = False

		# If showSource is enabled then process the frames, and get the diffed result for display
Example #4
0
currentFile = 0
processedFile = -1

# Display Vars
showSource = False
showBound = True
showBoundCenter = True

# Game Loop Sentinel
notDone = True
refresh = False

# Initialize Compare Object
if METHOD == algorithm.BACKGROUND_SUBTRACTION:
    # Load Current Frame and Background
    compare = CompareImages(ImageFile(files[0], 0), background)
elif METHOD == algorithm.FRAME_DIFFERENCING:
    # Load Current Frame and Next Frame, currentFile
    compare = CompareImages(ImageFile(files[0], 0), ImageFile(files[1], 1))

# Main Game Loop
while notDone:
    # Fill Display with Black
    screen.fill(BLACK)

    # Redraw. Switch Between Source Image Surface, and Diffed Image.
    if refresh:
        # Reset Refresh
        refresh = False

        # If showSource is enabled then process the frames, and get the diffed result for display