obtaining a feature vector using wavelets(DWT)

479 views
Skip to first unread message

Vandana Lingampally

unread,
Aug 27, 2020, 12:06:14 PM8/27/20
to PyWavelets
Hai!!
 
    I am involved in a project(based on python) in which I need to extract features of image dataset using wavelets(DWT) , then the feature set which I get from wavelets will be input to PCA to reduce dimensions or features and this reduced feature set is given to any one of the ML classifier to classify the images. As iam completely new to wavelets I have gone through the concepts.

The simple code that I understood

img=matplotlib.Image.imread('image name') // for loading image

coeffs=pywt.dwt2(img,'wavelet name',mode='periodization') //only for one image , if we want it to do for more(100s of images)images then how?

cA, (cH, cV, cD) = coeffs  //to extract coefficients

cA will have approximated coefficients, cH-horizontal, cV-vertical, cD-diagonal coefficients which are in the form of matrices, Now how to get feature vector from these coefficients and how it can be given as input to PCA.

I have seen LL,LH,HL,HH frequency subbands, I could not get relation between

LL,LH,HL,HH and cA, cH, cV, cD

I searched but I could not get any source code related. I kindly request to help 

Gregory Lee

unread,
Aug 31, 2020, 11:39:43 PM8/31/20
to pywav...@googlegroups.com
On Thu, Aug 27, 2020 at 12:06 PM Vandana Lingampally <vandana.li...@gmail.com> wrote:
Hai!!
 
    I am involved in a project(based on python) in which I need to extract features of image dataset using wavelets(DWT) , then the feature set which I get from wavelets will be input to PCA to reduce dimensions or features and this reduced feature set is given to any one of the ML classifier to classify the images. As iam completely new to wavelets I have gone through the concepts.

The simple code that I understood

img=matplotlib.Image.imread('image name') // for loading image

coeffs=pywt.dwt2(img,'wavelet name',mode='periodization') //only for one image , if we want it to do for more(100s of images)images then how?


To apply dwt2 in bulk to many images you can just supply the 3D stack of images and then make sure the `axes` argument corresponds to the axes you want to transform.

 

cA, (cH, cV, cD) = coeffs  //to extract coefficients

cA will have approximated coefficients, cH-horizontal, cV-vertical, cD-diagonal coefficients which are in the form of matrices, Now how to get feature vector from these coefficients and how it can be given as input to PCA.

I have seen LL,LH,HL,HH frequency subbands, I could not get relation between

LL,LH,HL,HH and cA, cH, cV, cD

cA = LL
cD = HH
LH, HL are cH, cV (although not sure which is which. LH means highpass on the second axis while HL is highpass on the first)
 

I searched but I could not get any source code related. I kindly request to help 

--
You received this message because you are subscribed to the Google Groups "PyWavelets" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pywavelets+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pywavelets/cf4500ae-26d8-49fc-b732-99c9d69fa368n%40googlegroups.com.

Vandana Lingampally

unread,
Sep 1, 2020, 1:51:58 AM9/1/20
to pywav...@googlegroups.com
Thanks Mr.Lee, I will try the solution given by you and comeback with doubts. Thanks once again

Reply all
Reply to author
Forward
0 new messages