A full-stack Django application that allows users to register, upload images and videos, and automatically enhance their quality using OpenCV, PIL, MoviePy, and NumPy. The system supports:
- User authentication (register, login, logout)
- Image enhancement (upscaling, denoising, sharpening, color boost)
- Video enhancement (frame-by-frame processing + audio preservation)
- Media management (upload, list, delete)
- Per-user image & video library
This README explains the setup, features, project structure, and usage.
- User registration
- Login & logout
- Login-required protection for media pages
Every image uploaded goes through:
- Upscaling (×3 using Lanczos interpolation)
- Denoising (Bilateral filter)
- Sharpening (Unsharp mask)
- Contrast & brightness adjustment
- Color saturation enhancement
- Saves both original & high-quality versions
Each frame is processed using the following:
- Upscaling (×3)
- Denoising for small frames
- Sharpening
- Brightness & contrast improvement
- Color enhancement
- Audio preserved using MoviePy
- List all your images
- List all your videos
- View enhanced results
- Delete media
| Area | Technology |
|---|---|
| Backend | Django |
| Media Processing | OpenCV, Pillow, NumPy, MoviePy |
| Frontend | HTML, CSS, JavaScript (AJAX JSON response) |
| Database | SQLite / PostgreSQL |
| Authentication | Django Auth System |
your_project/
│
├── media/ # Stores uploaded and enhanced media
│
├── app_name/
│ ├── models.py # UploadedImage & UploadedVideo models
│ ├── views.py # (Your provided code)
│ ├── forms.py
│ ├── urls.py
│ ├── templates/
│ ├── index.html
│ ├── login.html
│ ├── register.html
│ ├── home.html
│ ├── video_home.html
│ ├── upload.html
│ ├── upload_video.html
│
└── requirements.txt
git clone https://github.com/yourusername/yourrepo.git
cd yourrepopython3 -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windowspip install -r requirements.txtRequired packages include:
Django
opencv-python
pillow
numpy
moviepy
scikit-image
python manage.py migratepython manage.py createsuperuserpython manage.py runserverVisit:
http://127.0.0.1:8000/
When a user uploads an image:
- Stored temporarily
- Enhanced using:
upscale_image(image, scale_factor=3)
apply_denoising(image)
apply_sharpening(image)
adjust_contrast_brightness(image)
enhance_color(image)-
Saved as:
original_image.jpg high_quality_original_image.jpg -
Returns JSON:
{
"original_image_url": "...",
"high_quality_image_url": "..."
}Video is processed frame by frame:
- Extract each frame with OpenCV
- Enhance with same pipeline as images
- Save enhanced video (temporary)
- Add original audio using MoviePy
- Save as:
original.mp4
high_quality_original.mp4
| URL | Method | Description |
|---|---|---|
/upload/ |
POST | Upload & enhance image |
/home/ |
GET | List user images |
/delete-image/<id>/ |
POST | Delete image |
| URL | Method | Description |
|---|---|---|
/upload-video/ |
POST | Upload & enhance video |
/video-home/ |
GET | List user videos |
/delete-video/<id>/ |
POST | Delete video |
| URL | Description |
|---|---|
/register/ |
Create account |
/login/ |
Login |
/logout/ |
Logout |
useroriginal_imagehigh_quality_imageuploaded_at
useroriginal_videohigh_quality_videouploaded_at
- Uses Django built-in auth system
- CSRF protection enabled except AJAX upload
- Access to images/videos is user-restricted
- Add progress bar during enhancement
- Support batch processing
- Integrate WebSockets for real-time progress updates
- Add AI-based super resolution (ESRGAN)
MIT License — free to use, modify, and distribute.