Skip to content

aes3219563/Hirschman-Transform-Lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hirschman-Transform-Lib

This project provids basic computations for the CompressiveSensing-Hirschman branch.
To install, just use "pip install hirschman". Numpy module is required.
Usage:

import numpy as np
from hirschman import hirschman as h
my=h.computation()
#functions
dft_matrix=my.dftmtx(256) # return a 256-point dft matrx, not nomalized
hirschman_matrix=my.htm(128,256) # return a 256-point Hirschman Transfrom Matrix which is generated by the 128-point dft matrix
inverse_hirschman_matrix=my.ihtm(128,256) # return a 256-point inverse Hirschman Transfrom Matrix which is generated by the 128-point dft matrix, dft_matrix*inverse_hirschman_matrix=I
dwt_matrix=my.dwt(256,'db2') # generate the 256-point dwt matrix based on db2 wavelet. Wavelets supported: db2~db6,sym2~smy8
#suppose img is the target image, to sparsify img, one should do
img=np.eye(256)
sparse_img=dwt_matrix.dot(img).dot(dwt_matrix.H)
sub_matrix=my.randsubmtx(hirschman_matrix,128) # generate a 128x256 sub matrix from hirschman_matrix by randomly picking up 128 rows
# use sensing structure to sense the target image
sensing_result=sub_matrix.dot(sparse_img)
# to recover a single column from the compressed img
recovery_single_column=my.omp([sensing_result[:,0],sub_matrix,256]) # to recovery the first column form compressed img
# to recover the whole img
recovery=[]
for i in range(256):
    recovery.append(my.omp([sensing_result[:,i],sub_matrix,256]))
recovered_img=np.concatenate (recovery) 
#from sparse image to full
recovered_img_full=dwt_matrix.H.dot(recovered_img).dot(dwt_matrix)

About

To calculate Hirschaman Transform related computations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages