This is a simple desktop tool for image super-resolution. It allows users to upscale images using the FSRCNN model (×2 or ×4), including smaller/lightweight variants. The application uses OpenCV’s dnn_superres module under the hood, and provides a GUI built with CustomTkinter for ease of use.
- Choose an image from your computer
- Select a super-resolution model (FSRCNN ×2, ×4, small ×2, small ×4)
- Upscale the selected image
- Choose where to save the upscaled image (Save As)
- View both the original and upscaled image
- Dark-mode GUI with a modern look
The SR (super-resolution) models included in this project are not my own. They are open-source models publicly available:
- FSRCNN ×4
- FSRCNN ×2
- FSRCNN small ×4
- FSRCNN small ×2
These models are commonly used with OpenCV’s dnn_superres and are freely distributed under open licenses. You can find the original pre-trained models from publicly available repositories such as vashiegaran / Opencv-Super-Resolution GitHub.
- Python 3.x
opencv-contrib-pythoncustomtkintertkinter(built-in with standard Python)
-
Clone or download this repository.
-
Place the model files (
.pb) in a folder namedmodels/inside the project directory. -
(Recommended) Create and activate a virtual environment:
python -m venv venv venv\Scripts\activate # on Windows source venv/bin/activate # on macOS / Linux
-
Install the required packages:
pip install opencv-contrib-python customtkinter
-
Run the GUI application:
python upscale_gui.py
- Open the app.
- Click Browse to choose your image.
- Select one of the SR models from the dropdown.
- Click Upscale to process the image.
- Choose where to save the output image via “Save As” dialog.
- After processing, the app will show the original and upscaled image.
import cv2
from cv2 import dnn_superres
sr = dnn_superres.DnnSuperResImpl_create()
sr.readModel("models/FSRCNN_x4.pb")
sr.setModel("fsrcnn", 4)
img = cv2.imread("input.jpg")
up = sr.upsample(img)
cv2.imwrite("upscaled.jpg", up)- The FSRCNN models provided are open-source and not developed by me.
- This project is for educational / personal use. Use the models responsibly and respect their original licenses.
- No guarantee is provided for commercial use; check the license of the original model repositories.
هذا برنامج بسيط على سطح المكتب لتحسين جودة الصور (super-resolution). يتيح للمستخدم تكبير الصور باستخدام موديل FSRCNN بمقياس ×2 أو ×4، وكذلك الإصدارات الصغيرة (lightweight). التطبيق يعتمد على وحدة dnn_superres من OpenCV، ويستخدم واجهة CustomTkinter لتسهيل الاستخدام.
- اختيار صورة من جهازك
- اختيار موديل SR من قائمة (FSRCNN ×2، ×4، small ×2، small ×4)
- تكبير الصورة
- اختيار مكان الحفظ عبر نافذة “Save As”
- عرض الصورة الأصلية والمكبرة
- واجهة داكنة (Dark Mode) بمظهر حديث
الموديلات (SR) المستخدمة في المشروع ليست من صنعتي. هي موديلات مفتوحة المصدر متاحة للعامة:
- FSRCNN ×4
- FSRCNN ×2
- FSRCNN small ×4
- FSRCNN small ×2
هذه الموديلات غالبًا تُستخدم مع dnn_superres في OpenCV وهي موزعة بحرية وفق تصاريح مفتوحة المصدر. من المستودعات المعروفة التي تحتوي الموديلات مثل: مستودع Opencv‑Super‑Resolution بواسطة vashiegaran على GitHub.
- بايثون 3 وما فوق
- مكتبة
opencv-contrib-python - مكتبة
customtkinter - مكتبة
tkinter(مضمنة غالبًا مع بايثون القياسي)
-
انسخ أو حمّل هذا المستودع.
-
ضع ملفات الموديلات (
.pb) داخل مجلد باسمmodels/في مجلد المشروع. -
(من المفضل) أنشئ وفعّل بيئة افتراضية:
python -m venv venv venv\Scripts\activate # على Windows source venv/bin/activate # على macOS / Linux
-
ثبّت المكتبات المطلوبة:
pip install opencv-contrib-python customtkinter
-
شغّل التطبيق:
python upscale_gui.py
- افتح التطبيق.
- اضغط استعراض لاختيار الصورة.
- اختر موديل التكبير من القائمة المنسدلة.
- اضغط تكبير الصورة لمعالجة الصورة.
- اختر في أي مكان تحفظ الصورة المكبرة عبر نافذة “Save As”.
- بعد المعالجة، سيُعرض لك الصورة الأصلية والمكبرة.
import cv2
from cv2 import dnn_superres
sr = dnn_superres.DnnSuperResImpl_create()
sr.readModel("models/FSRCNN_x4.pb")
sr.setModel("fsrcnn", 4)
img = cv2.imread("input.jpg")
up = sr.upsample(img)
cv2.imwrite("upscaled.jpg", up)- موديلات FSRCNN المستخدمة في هذا المشروع هي مفتوحة المصدر وليست من تأليفي.
- هذا المشروع مخصص للاستخدام التعليمي أو الشخصي. استخدم الموديلات بمسؤولية واحترم تراخيصها الأصلية.
- لا يوجد ضمان للاستخدام التجاري، فتحقق من تراخيص المستودعات الأصلية للموديلات قبل الاستخدام التجاري.