def getTransform_sift(self, centerimagedata1, griddata2):
		# Not yet working
		griddata1 = centerimagedata1['grid']
		result = self.loadTransform(griddata1, griddata2)
		if result is None:
			centerimagedata2 = self.reacquireImage(centerimagedata1,
																							griddata=griddata2)
			image1 = centerimagedata1['image']
			image2 = centerimagedata2['image']
			self.logger.info('Calculating main transform...')
			resultold = align.findRotationScaleTranslation(image1, image2)
			resultmatrix = libCVwrapper.MatchImages(image1, image2)
			# The following conversion may be incorrect
			rotation = math.atan2(resultmatrix[(0,1)],resultmatrix[(1,1)])
			scale = 1
			shift = (resultmatrix[(0,0)],resultmatrix[(1,0)])
			result = rotation,scale,shift,1,1
			self.saveTransform(result, griddata1, griddata2)
		else:
			self.logger.info('Loading main transform...')
		rotation, scale, shift, rsvalue, value = result
		rsm = 'Rotation: %g, scale: %g, peak value: %g' % (rotation, scale, rsvalue)
		tm = 'shift: (%g, %g), peak value: %g' % (shift + (value,))
		self.logger.info(rsm + ', ' + tm)

		return result, centerimagedata2
    def getTransform_sift(self, centerimagedata1, griddata2):
        # Not yet working
        griddata1 = centerimagedata1['grid']
        result = self.loadTransform(griddata1, griddata2)
        if result is None:
            centerimagedata2 = self.reacquireImage(centerimagedata1,
                                                   griddata=griddata2)
            image1 = centerimagedata1['image']
            image2 = centerimagedata2['image']
            self.logger.info('Calculating main transform...')
            resultold = align.findRotationScaleTranslation(image1, image2)
            resultmatrix = libCVwrapper.MatchImages(image1, image2)
            # The following conversion may be incorrect
            rotation = math.atan2(resultmatrix[(0, 1)], resultmatrix[(1, 1)])
            scale = 1
            shift = (resultmatrix[(0, 0)], resultmatrix[(1, 0)])
            result = rotation, scale, shift, 1, 1
            self.saveTransform(result, griddata1, griddata2)
        else:
            self.logger.info('Loading main transform...')
        rotation, scale, shift, rsvalue, value = result
        rsm = 'Rotation: %g, scale: %g, peak value: %g' % (rotation, scale,
                                                           rsvalue)
        tm = 'shift: (%g, %g), peak value: %g' % (shift + (value, ))
        self.logger.info(rsm + ', ' + tm)

        return result, centerimagedata2
Ejemplo n.º 3
0
	def register(self, array1, array2):
		result = align.findRotationScaleTranslation(array1, array2)
		rotation, scale, shift, rsvalue, value = result
		matrix = numpy.matrix(numpy.identity(3, numpy.float))
		matrix[0,0] = scale*math.cos(rotation)
		matrix[0,1] = -scale*math.sin(rotation)
		matrix[1,0] = scale*math.sin(rotation)
		matrix[1,1] = scale*math.cos(rotation)
		matrix[2,0] = shift[0]
		matrix[2,1] = shift[1]
		return matrix
Ejemplo n.º 4
0
 def register(self, array1, array2):
     result = align.findRotationScaleTranslation(array1, array2)
     rotation, scale, shift, rsvalue, value = result
     matrix = numpy.matrix(numpy.identity(3, numpy.float))
     matrix[0, 0] = scale * math.cos(rotation)
     matrix[0, 1] = -scale * math.sin(rotation)
     matrix[1, 0] = scale * math.sin(rotation)
     matrix[1, 1] = scale * math.cos(rotation)
     matrix[2, 0] = shift[0]
     matrix[2, 1] = shift[1]
     return matrix
	def getTransform(self, centerimagedata1, griddata2):
		griddata1 = centerimagedata1['grid']
		result = self.loadTransform(griddata1, griddata2)
		if result is None:
			centerimagedata2 = self.reacquireImage(centerimagedata1,
																							griddata=griddata2)
			image1 = centerimagedata1['image']
			image2 = centerimagedata2['image']
			self.logger.info('Calculating main transform...')
			result = align.findRotationScaleTranslation(image1, image2)
			self.saveTransform(result, griddata1, griddata2)
		else:
			self.logger.info('Loading main transform...')
		rotation, scale, shift, rsvalue, value = result
		rsm = 'Rotation: %g, scale: %g, peak value: %g' % (rotation, scale, rsvalue)
		tm = 'shift: (%g, %g), peak value: %g' % (shift + (value,))
		self.logger.info(rsm + ', ' + tm)

		return result, centerimagedata2
    def getTransform(self, centerimagedata1, griddata2):
        griddata1 = centerimagedata1['grid']
        result = self.loadTransform(griddata1, griddata2)
        if result is None:
            centerimagedata2 = self.reacquireImage(centerimagedata1,
                                                   griddata=griddata2)
            image1 = centerimagedata1['image']
            image2 = centerimagedata2['image']
            self.logger.info('Calculating main transform...')
            result = align.findRotationScaleTranslation(image1, image2)
            self.saveTransform(result, griddata1, griddata2)
        else:
            self.logger.info('Loading main transform...')
        rotation, scale, shift, rsvalue, value = result
        rsm = 'Rotation: %g, scale: %g, peak value: %g' % (rotation, scale,
                                                           rsvalue)
        tm = 'shift: (%g, %g), peak value: %g' % (shift + (value, ))
        self.logger.info(rsm + ', ' + tm)

        return result, centerimagedata2