A powerful desktop application for real-time frequency domain analysis of images using Fast Fourier Transform (FFT) and Discrete Cosine Transform (DCT) with interactive 3D visualizations.
- FFT (Fast Fourier Transform): Analyze frequency components with optional FFT shifting
- DCT (Discrete Cosine Transform): Side-by-side DCT visualization for comparison
- Real-time Processing: Background computation with automatic cancellation of outdated requests
Choose from three visualization modes:
- Unit Height: All points at z=1, perfect for viewing the frequency distribution pattern
- Magnitude Height: Height represents magnitude, ideal for identifying dominant frequencies
- Normalized Mode: Normalized coordinates with magnitude-based height for balanced view
- Dynamic Filters: Add multiple frequency or amplitude-based band-stop filters
- Real-time Preview: See filtered results instantly as you adjust parameters
- Dual Filter Types:
- Frequency-domain filtering (by radial frequency)
- Amplitude-domain filtering (by magnitude values)
- 2D heatmap visualization of frequency power distribution
- Logarithmic or linear scale options
- Color-coded intensity mapping
- Real-time reconstruction from filtered frequency domain
- Export reconstructed images at original resolution
- Automatic scaling and normalization
python >= 3.8pip install numpy opencv-python scipy PyQt6 matplotlibOr using requirements.txt:
pip install -r requirements.txtnumpy>=1.20.0
opencv-python>=4.5.0
scipy>=1.7.0
PyQt6>=6.0.0
matplotlib>=3.4.0
python main.py-
Load an Image
- Click "Load Image" button
- Select any grayscale or color image (auto-converted to grayscale)
- Image will be displayed in the bottom-left panel
-
Compute Transforms
- Click "Compute FFT" to analyze frequency domain
- Click "Compute DCT" for discrete cosine transform
- Both can run simultaneously for comparison
-
Explore Visualization Modes
- Unit Height: Best for seeing overall frequency distribution
- Magnitude Height: Emphasizes dominant frequency components
- Normalized + Magnitude: Balanced view with normalized coordinates
-
Apply Filters
- Click "+ Add filter" to create a new filter
- Choose filter type:
freq(frequency) oramp(amplitude) - Set low and high range values
- Enable/disable filters with checkboxes
- Watch real-time reconstruction updates
-
Export Results
- Click "Export Image" to save the reconstructed image
- Output is automatically scaled to original image dimensions
┌─────────────────────────────────────┬──────────────┐
│ 3D FFT Visualization (Left) │ Control │
│ 3D DCT Visualization (Right) │ Panel │
├─────────────────────────────────────┤ │
│ Power Spectral Density (PSD) │ • Load │
├─────────────────────────────────────┤ • Compute │
│ Original │ FFT Recon │ DCT Recon │ • Options │
│ Image │ Image │ Image │ • Filters │
└────────────┴────────────┴───────────┴──────────────┘
- Signal Processing Courses: Visualize FFT/DCT concepts in 2D
- Image Compression: Understand frequency domain compression (JPEG uses DCT)
- Filter Design: Experiment with frequency filtering effects
- Frequency Analysis: Identify periodic patterns in images
- Noise Reduction: Design and test frequency-based noise filters
- Image Enhancement: Remove specific frequency bands (moiré patterns, scanning artifacts)
- Artistic Effects: Create unique filtered image effects
- Pattern Recognition: Analyze repeating patterns in textures
- Quality Assessment: Detect compression artifacts
Asynchronous Processing
- Background worker thread handles all heavy computations
- Latest-only request queue prevents UI blocking
- Automatic cancellation of stale requests when parameters change
Performance Optimizations
- Cached PSD computations to avoid redundant calculations
- Percentile-based axis limits for efficient rendering
- Smart sampling for 3D visualization (1/50th of resolution)
Memory Management
- Proper cleanup on application exit
- Reference nulling for large arrays
- Matplotlib figure cleanup to prevent memory leaks
- 2D FFT:
numpy.fft.fft2()with optionalfftshiftfor centered frequency display - 2D DCT:
scipy.fft.dct()with orthonormal normalization - Filtering: Radial frequency masking or magnitude-based masking
- Reconstruction: Inverse transforms with proper normalization
Contributions are welcome! Here are some ideas:
- Add wavelet transform support
- Add phase visualization
- Interactive filter design with visual frequency selection
- Export capability for 3D plots
git clone https://github.com/yourusername/ffted.git
cd ffted
pip install -r requirements.txt
python main.pyThis project is licensed under the MIT License - see the LICENSE file for details.
- Built with PyQt6 for the GUI framework
- NumPy and SciPy for mathematical operations
- Matplotlib for visualization
- OpenCV for image I/O
Have questions or suggestions? Feel free to open an issue or reach out!
Note: This tool is designed for educational and research purposes. For production image processing, consider specialized libraries like scikit-image or dedicated FFT tools.