Accelerated Evolution

# Sanjuro

Members

8

• #### Last visited

• Rank
Total Noob
• Birthday 07/19/1987
1. ## slow DFT is slow

Working on what should've been a quick and easy assignment for my digital image processing class...but yeah, it's not quite as quick as I thought. -We're given a test image, which we load into our c++ program. -We zero-pad the sucker to oblivion -We're supposed to shift the image data by (-1)^(X+Y)...which presents a little problem since the image data is unsigned -Then we compute the DFT of the image, using the definition of DFT...and for our 206x156 test image this takes just shy of 2.5 hours -We then apply an ideal low pass filter -Compute the inverse DFT -Write the result out to a different image file I'm just ignoring the whole multiply odd-row even numbered and even-row odd numbered pixels by -1 for now, but the DFT is killing me. Over 2 hours before I find out if I have a mistake or not... On the off chance someone here can look at what I've got and know if it's wrong or not... void DFT(int rows, int cols, unsigned char** &image, unsigned char** &result, bool inverse) { //computes the DFT of the image given by the image parameter //it will instead compute the IDFT if inverse is set to true //we need to make use of the complex template class to get sqrt(-1) //complex<double> i (0.0,1.0); complex<double> forward_const (0,-2*PI); complex<double> inverse_const (0,2*PI); complex<double> normalize_const ((rows*cols),0); if(!inverse) { //set up a temp array to hold the complex values complex<double>** temp = (complex<double>**)malloc(rows*sizeof(complex<double>*)); for(int i = 0; i < HEIGHT; i++) { *(temp + i) = (complex<double>*)malloc(cols*sizeof(complex<double>)); } for(int u = 0; u < rows; u++) { for(int v = 0; v < cols; v++) { cout << "u = " << u << ", v = " << v << endl; for(int x = 0; x < rows; x++) { for(int y = 0; y < cols; y++) { complex<double> iterating_var ((((u*x)/cols)+((v*y)/rows)),0.0); temp[u][v] = temp[u][v] + (complex<double>)image[x][y]*exp(forward_const*iterating_var); } } //I need the fourier spectrum to see if I did it right result[u][v] = (unsigned char)sqrt(pow(real(temp[u][v]),2) + pow(imag(temp[u][v]),2)); } } } else { //inverse DFT goes here } }
2. ## Boolean Algebra and other shit

I don't think it'd make any difference, but try replacing your main with float r; float v; float s; r = getRadius(); v = computeVolume(); s = computeSurfacearea(); displayResult(v,s); system("PAUSE"); return EXIT_SUCCESS; If the code tag is what your file contains you'll need to get rid of the extra semicolon at the end of the function definition for getSurfacarea() and change the closing brace right after it to an opening brace (same with displayResult())
3. ## 5,000 bottles of beer on the wall: The Fucking Return.

4,450 bottles of beer on the wall, 4,450 bottles of beer you take one down, put it back up, change your mind again and take it down again but say "screw everyone else, I'm drinking this one" 4,449 bottles of beer on the wall
4. ## 5,000 bottles of beer on the wall: The Fucking Return.

4,455 bottles of beer on the wall, 4,455 bottles of beer I like to think that everyone just got so drunk that we forgot where we were and just decided to start over again 4,454 bottles of beer on the wall
5. ## Random Thoughts: New Thread is New

Trolli is set on making me addicted to their candystuffs
6. ## Sleeping Habits

-Twin extra long (ie. standard college dorm bed) -Usually between 7 and 9. Can function on 4 hours for a few days but yeah...not fun. -I don't usually use any sleep aids, but I'll take 6mg of Melatonin if I absolutely need to switch my schedule. -Near complete silence. A gentle breeze, leaves rustling and the occasional car passing aren't problems. Suitemates talking/playing CoD presents problems though. (some -29dB earplugs can usually take care of that if needed)
7. ## 5,000 bottles of beer on the wall: The Fucking Return.

4458 bottles of beer on the wall...4,458 bottles of beer Don't think, just drink. Got it. 4457 bottles of beer on the wall
8. ## Boolean Algebra and other shit

I dunno what you guys are talking about...K-maps are the shit I might be able to recall my digital logic course as well
9. ## Yo

Nah not really. I think I ragequit back in 2005 after a long day of work followed by trying to defend my buddy samurai drifter. Funny thing is, he ended up getting banned right after I left. doinitrite Unfortunately that legacy has been lost to the abyss...something about less than legal forum software if I recall Did I have a .hack avatar back then? only one I can remember is my Legato Bluesummers one. Not too bad man. Trying to land a job with my degrees, but who isn't these days? Nice to meet you as well
10. ## 5,000 bottles of beer on the wall: The Fucking Return.

4,460 bottles of beer on the wall...4,460 bottles of beer take one down, wonder where all this beer came from 4,459 bottles of beer on the wall
11. ## Yo

Hey guys, it's been a few years. So...yeah, hi and stuff. Well then, I think I'll go pay a visit to SHFTZ now /wonders if anyone remembers
×

• #### Activity

×
• Create New...