Motion Detection is a Python program that detects motion between two BMP image files by comparing pixel intensity values. The images are converted to grayscale and analyzed to determine if motion has occurred between them. The result is saved as a new output image.
This project is useful for basic image processing demonstrations, learning motion detection logic, and experimenting with pixel-based comparison algorithms in Python.
- Read and write BMP image files
- Convert images to grayscale
- Detect motion between two images
- Save output image with motion highlights
- Programming Language: Python 3.x
-
Clone the repository:
git clone https://github.com/ollqherTR/Motion-Detection.git cd Motion-Detection -
(Optional) Create a virtual environment:
python3 -m venv venv source venv/bin/activate # macOS/Linux venv\Scripts\activate # Windows
-
Install dependencies (if any):
pip install -r requirements.txt
-
Place two BMP images (e.g.,
sample1.bmp,sample2.bmp) in the project directory. -
Run the motion detection script:
python Main.py
-
The program will produce:
- Grayscale versions of images
- A result image (
result.bmp) showing motion detection output
-
The terminal will indicate whether motion was detected or not.
The program loads two BMP images, converts them to grayscale, and compares pixel values between the two frames. Changes above a certain threshold are considered motion. This method uses basic background subtraction and pixel difference, common in simple motion detection tasks.
Motion Detection, iki BMP resim dosyası arasındaki hareketi, piksel yoğunluklarını karşılaştırarak tespit eden bir Python programıdır. Resimler gri tonlara dönüştürülür ve piksel farkları kullanılarak hareket analizi yapılır. Sonuç yeni bir BMP dosyası olarak kaydedilir.
Bu proje, temel görüntü işleme gösterimleri, basit hareket tespiti algoritmalarını öğrenmek ve Python ile piksel karşılaştırma mantığını denemek için uygundur.
- BMP görüntü dosyalarını okuma ve yazma
- Görüntüleri gri tona dönüştürme
- İki resim arasında hareket tespiti
- Hareket sonucunu içeren yeni BMP dosyası oluşturma
- Programlama Dili: Python 3.x
-
Depoyu klonlayın:
git clone https://github.com/ollqherTR/Motion-Detection.git cd Motion-Detection -
(İsteğe bağlı) Sanal ortam oluşturun:
python3 -m venv venv source venv/bin/activate # macOS/Linux venv\Scripts\activate # Windows
-
Bağımlılıkları yükleyin (varsa):
pip install -r requirements.txt
-
İki BMP resmi (örneğin
sample1.bmp,sample2.bmp) proje klasörüne yerleştirin. -
Hareket tespit scriptini çalıştırın:
python Main.py
-
Program şunları üretecektir:
- Resimlerin gri tonlu halleri
result.bmpdosyasında hareket tespit sonucu
-
Terminalde hareket algılandı / algılanmadı mesajı görüntülenecektir.
Program iki BMP resmini yükler, gri tonlara dönüştürür ve iki resim arasındaki piksel değerlerini karşılaştırır. Belirli eşik değerlerin üzerindeki değişimler hareket olarak kabul edilir. Bu yöntem basit arka plan çıkarma ve piksel farkı kullanımıyla yapılan temel hareket tespit tekniklerinden biridir.
Mert Eren Dilsiz