Raspberry Pi Lesson: OpenCV Car Counter


Raspberry Pi OpenCV Car Counter adalah bagi mengira bilangan kereta atau objek yang bergerak. Oleh kerana tiada live video, jadi hanya menggunakan video contoh kereta yang bergerak. OpenCV akan melakukan proses video dan mengedit video tersebut. Titik merah akan menandakan kedudukan kereta, garisan hijau menandakan lintasan yang akan diambil kira dan tulisan biru memaparkan bilangan semasa. Namun cara ini masih ada kelemahan bagi mengenalpasti kereta.

Proses video ini hanya menggunakan OpenCV. Melalui Terminal Raspberry Pi, gunakan command berikut.

$ sudo pip install opencv-python
$ sudo pip install imutils

Download video contoh disini.

Berikut adalah demo Raspberry Pi OpenCV Car Counter.

Video dari file

Video dari camera

Python Source Code

Sertai Telegram Group bagi dapatkan source code


5 responses to “Raspberry Pi Lesson: OpenCV Car Counter”

  1. Can explain more clearly about this part of code for me:
    sen=sen<<1
    else:
    sen=(sen<<1)|1
    sen=sen&0x03
    if sen==1:
    counter=counter+1
    Here, what role that " sen " play in the counting part ?. And i also wonder how the counter didnt plus + 1 when the centroid have x greater than linecount after counted ?. Thank you very much.

  2. So can you explain ”sec” mean in this code? I tried to find information about this line of code but it is no clue in opencv. That would be nice if u can tell some info about it. Thank u

Leave a Reply to Shahrul Cancel reply

Your email address will not be published. Required fields are marked *