<< Chapter < Page
  Digital signal processing - dsp     Page 4 / 21
Chapter >> Page >

The xform2D method

The beginning of the class and the beginning of the static method named xform2D is shown in Listing 1 .

This method computes a forward 2D Fourier transform from the space domain into the wavenumber domain. The number of points produced for the wavenumberdomain matches the number of points received for the space domain in both dimensions. Note that the input data must be purely real. In other words, theprogram assumes that there are no imaginary values in the space domain. Therefore, this is not a general purpose 2D complex-to-complex transform.

Listing 1. Beginning of the class named ImgMod30.
class ImgMod30{ static void xform2D(double[][] inputData,double[][]realOut, double[][] imagOut,double[][]amplitudeOut){ int height = inputData.length;int width = inputData[0].length;System.out.println("height = " + height);System.out.println("width = " + width);

Parameters

The first parameter is a reference to a 2D double array object containing the data to be transformed. The remaining three parameters arereferences to 2D double array objects of the same size that will be populated with the following transform results:

  • The real part
  • The imaginary part
  • The amplitude (square root of sum of squares of the real and imaginary parts)

Listing 1 also determines and displays the dimensions of the incoming 2D array of data to be transformed.

I won't bore you with the details as to how and why the 2D Fourier transform does what it does. Neither will I bore you with the details of the code thatimplements the 2D Fourier transform. If you understand the material that I have previously published on Fourier transforms in one dimension, this code and these concepts should be astraightforward extension from one dimension to two dimensions.

The remainder of the xform2D method

The remainder of the xform2D method is shown in Listing 2 . Note that it was necessary to sacrifice indentation in order to force these very long equationsto be compatible with this narrow publication format and still be somewhat readable.

Listing 2. The remainder of the xform2D method.
//Two outer loops iterate on output data. for(int yWave = 0;yWave<height;yWave++){ for(int xWave = 0;xWave<width;xWave++){ //Two inner loops iterate on input data.for(int ySpace = 0;ySpace<height; ySpace++){for(int xSpace = 0;xSpace<width; xSpace++){//Compute real, imag, and ampltude. realOut[yWave][xWave] +=(inputData[ySpace][xSpace]*cos(2*PI*((1.0* xWave*xSpace/width)+(1.0*yWave*ySpace/height))))/sqrt(width*height);imagOut[yWave][xWave ]-= (inputData[ySpace][xSpace]*sin(2*PI*((1.0*xWave*xSpace/width) + (1.0*yWave*ySpace/height)))) /sqrt(width*height);amplitudeOut[yWave][xWave] =sqrt( realOut[yWave][xWave] * realOut[yWave][xWave] +imagOut[yWave][xWave]* imagOut[yWave][xWave]); }//end xSpace loop}//end ySpace loop }//end xWave loop}//end yWave loop }//end xform2D method

The inverseXform2D method

The inverseXform2d method is shown in its entirety in Listing 3 . This method computes an inverse 2D Fourier transform from the complex wavenumber domain into thereal space domain. The number of points produced for the space domain matches the number of points received for the wavenumber domain in both dimensions.

Questions & Answers

what is mutation
Janga Reply
what is a cell
Sifune Reply
how is urine form
Sifune
what is antagonism?
mahase Reply
classification of plants, gymnosperm features.
Linsy Reply
what is the features of gymnosperm
Linsy
how many types of solid did we have
Samuel Reply
what is an ionic bond
Samuel
What is Atoms
Daprince Reply
what is fallopian tube
Merolyn
what is bladder
Merolyn
what's bulbourethral gland
Eduek Reply
urine is formed in the nephron of the renal medulla in the kidney. It starts from filtration, then selective reabsorption and finally secretion
onuoha Reply
State the evolution relation and relevance between endoplasmic reticulum and cytoskeleton as it relates to cell.
Jeremiah
what is heart
Konadu Reply
how is urine formed in human
Konadu
how is urine formed in human
Rahma
what is the diference between a cavity and a canal
Pelagie Reply
what is the causative agent of malaria
Diamond
malaria is caused by an insect called mosquito.
Naomi
Malaria is cause by female anopheles mosquito
Isaac
Malaria is caused by plasmodium Female anopheles mosquitoe is d carrier
Olalekan
a canal is more needed in a root but a cavity is a bad effect
Commander
what are pathogens
Don Reply
In biology, a pathogen (Greek: πάθος pathos "suffering", "passion" and -γενής -genēs "producer of") in the oldest and broadest sense, is anything that can produce disease. A pathogen may also be referred to as an infectious agent, or simply a germ. The term pathogen came into use in the 1880s.[1][2
Zainab
A virus
Commander
Definition of respiration
Muhsin Reply
respiration is the process in which we breath in oxygen and breath out carbon dioxide
Achor
how are lungs work
Commander
where does digestion begins
Achiri Reply
in the mouth
EZEKIEL
what are the functions of follicle stimulating harmones?
Rashima Reply
stimulates the follicle to release the mature ovum into the oviduct
Davonte
what are the functions of Endocrine and pituitary gland
Chinaza
endocrine secrete hormone and regulate body process
Achor
while pituitary gland is an example of endocrine system and it's found in the Brain
Achor
what's biology?
Egbodo Reply
Biology is the study of living organisms, divided into many specialized field that cover their morphology, physiology,anatomy, behaviour,origin and distribution.
Lisah
biology is the study of life.
Alfreda
Biology is the study of how living organisms live and survive in a specific environment
Sifune
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Digital signal processing - dsp. OpenStax CNX. Jan 06, 2016 Download for free at https://legacy.cnx.org/content/col11642/1.38
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing - dsp' conversation and receive update notifications?

Ask