11 Mart 2017 Cumartesi

OpenCV C++ Show Webcam Stream on Qt GUI

OpenCV  C++ Show Webcam Stream on Qt GUI

( Qt GUI'de kamera görüntüsünü OpenCV-C++ kullanarak gösterme )



Step 1.  Click “New Project” button on Qt Creator

(Adım 1.  Qt Creator'de “New Project” butonuna tıklayınız) 


Step 2.  Choose “Qt Widgets Application”

(Adım 2.  Proje için “Qt Widgets Application” seçiniz)


Step 3.  Give a name to your project and define location to create your new project

(Adım 3. Projenize isim verin ve kaydedilecek dosyayı belirleyiniz)  


Step 4.  Select “kit” and click “Next” button

(Adım 4.  Derleyici seçiniz ve "Next" butonuna tıklayınız)


Step 5.  Select “QMainWindow” for your project and click “Next”

(Adım 5.  Proje için “QMainWindow” seçiniz ve "Next" butonuna tıklayınız)


Step 6.  “Finish” the creation of your new project

(Adım 6.  Projeyi oluşturmak için "Finish" butonuna tıklayınız)


Step 7.  Click “opencv_cpp_show_webcam_stream_on_Qt_GUI.pro” and define your openCV path and libraries.

(Adım 7.   Proje dosyasına “opencv_cpp_show_webcam_stream_on_Qt_GUI.pro” tıklayınız ve OpenCV kütüphanelerinin olduğu yolu tanımlayınız) 


INCLUDEPATH += G:\\opencv\\build\\include \


LIBS += -LG:\\opencv\\build\\bin \
libopencv_calib3d310 \
libopencv_core310 \
libopencv_features2d310 \
libopencv_flann310 \
libopencv_highgui310 \
libopencv_imgcodecs310 \
libopencv_imgproc310 \
libopencv_ml310 \
libopencv_objdetect310 \
libopencv_photo310 \
libopencv_shape310 \
libopencv_stitching310 \
libopencv_superres310 \
libopencv_video310 \
libopencv_videoio310 \
libopencv_videostab310

Step 8.  Click “mainwindow.ui”

(Adım 8.  “mainwindow.ui” arayüz tasarım sayfasını açınız)


Step 9.  Drag and Drop 2 “Push Button”

(Adım 9.  2 tane “Push Button” 'u sürekle-bırakla arayüze ekleyiniz)


Give Object name as “pushButton_open_webcam” and “pushButton_close_webcam”

(Object name olarak “pushButton_open_webcam” ve “pushButton_close_webcam” isimlerini veriniz)

Step 10.  Drag and Drop “Label” to show webcam stream

(Adım 10.  Arayüze kamera görüntüsünü göstermek için "Label" ekleyin)


Step 11.  Click right button of your mouse on the "Open Webcam" button and select “Go to slot” and select “clicked()” signal

(Adım 11.  Farenin sağ tuşuna "Open Webcam" butonu üzerinde basınız ve  “Go to slot” 'u seçiniz ve açılan pencerede “clicked()” sinyalini seçiniz



Do same thing for “Close Webcam” button

(Aynı işlemi "Close Webcam" butonu için de yapınız)

Step 12.  Make following changes to “mainwindow.h”

(Adım 12.  “mainwindow.h” dosyasında aşağıdaki değişiklikleri yapınız)


Step 13.   Make following changes to “mainwindow.cpp”

(Adım 13.  “mainwindow.cpp” dosyasında aşağıdaki değişiklikleri yapınız)



Step 14.  Your application is ready

(Adım 14.  Uygulamanız hazır)











2 yorum:

  1. QT ve OpenCV nin yeni versiyonlar için biraz güncelleme yapmak gerekiyor.Githubtaki OpenCV_CPP_show_webcam_stream_on_Qt_GUI.pdf dosyasının güncellenmesi lazım. Küçük hatalar var.

    YanıtlaSil
    Yanıtlar
    1. Merhaba ilginiz için teşekkürler. Hatalardan bahsederseniz düzeltmem daha kolay olur.

      Sil