modules/motion.py
def register_stack(imstack, full_res, method=StackReg.RIGID_BODY):
    '''
        Register a stack of images and get coordinates
        
        Inputs:
            imstack: nimg x H x W stack of images
            full_res: Resolution at which images will be super resolved
            method: Method to use for registration. Default is StackReg.RIGID_BODY
            
        Outputs:
            reg_mats: (nimg, 2, 3) dimensional registration matrices
    '''
    nimg, H, W = imstack.shape
    Hr, Wr = full_res

    imstack_full = np.zeros((nimg, Hr, Wr))
    
    # Upsample the images
    for idx in range(nimg):
        imstack_full[idx, ...] = cv2.resize(imstack[idx, ...], (Wr, Hr),
                                            interpolation=cv2.INTER_AREA)
    
    # Now register the stack
    reg = StackReg(method)
    reg_mats = reg.register_stack(imstack_full, reference='first', verbose=True)
    
    return reg_mats

        Register a stack of images and get coordinates
        
        Inputs:
            imstack: nimg x H x W stack of images
            full_res: Resolution at which images will be super resolved
            method: Method to use for registration. Default is StackReg.RIGID_BODY
            
        Outputs:
            reg_mats: (nimg, 2, 3) dimensional registration matrices
    
Register a stack of images and get coordinates
Inputs:
imstack: nimg x H x W stack of images
full_res: Resolution at which images will be super resolved
method: Method to use for registration.

(nimg, 2, 3) dimensional registration matrices
Register a stack of images and get coordinates Inputs : imstack : nimg x H x W stack of images full_res : Resolution at which images will be super resolved method : Method to use for registration . ( nimg 2 3 ) dimensional registration matrices
def register_stack(imstack, full_res, method=StackReg.RIGID_BODY):
    nimg, H, W = imstack.shape
    Hr, Wr = full_res
    imstack_full = np.zeros((nimg, Hr, Wr))
    for idx in range(nimg):
        imstack_full[idx, ...] = cv2.resize(imstack[idx, ...], (Wr, Hr),
                                            interpolation=cv2.INTER_AREA)
    reg = StackReg(method)
    reg_mats = reg.register_stack(imstack_full, reference='first', verbose=True)
    return reg_mats
def register_stack ( imstack , full_res , method = StackReg . RIGID_BODY ) : nimg , H , W = imstack . shape Hr , Wr = full_res imstack_full = np . zeros ( ( nimg , Hr , Wr ) ) for idx in range ( nimg ) : imstack_full [ idx , ... ] = cv2 . resize ( imstack [ idx , ... ] , ( Wr , Hr ) , interpolation = cv2 . INTER_AREA ) reg = StackReg ( method ) reg_mats = reg . register_stack ( imstack_full , reference = 'first' , verbose = True ) return reg_mats
Register a stack of images and get coordinates
Inputs:
imstack: nimg x H x W stack of images
full_res: Resolution at which images will be super resolved
method: Method to use for registration.
Register a stack of images and get coordinates Inputs : imstack : nimg x H x W stack of images full_res : Resolution at which images will be super resolved method : Method to use for registration .
'''
        Register a stack of images and get coordinates
        
        Inputs:
            imstack: nimg x H x W stack of images
            full_res: Resolution at which images will be super resolved
            method: Method to use for registration. Default is StackReg.RIGID_BODY
            
        Outputs:
            reg_mats: (nimg, 2, 3) dimensional registration matrices
    ''' # Upsample the images # Now register the stack
imstack
full_res
method