Skip to content
Snippets Groups Projects
Select Git revision
  • d27d1e26273ddeaa1a8e34efe2f6e00b5351717a
  • master default protected
  • beta
  • dev
  • andrewssobral-patch-1
  • update
  • thomas-fork
  • 2.0
  • v3.2.0
  • v3.1.0
  • v3.0
  • bgslib_py27_ocv3_win64
  • bgslib_java_2.0.0
  • bgslib_console_2.0.0
  • bgslib_matlab_win64_2.0.0
  • bgslib_qtgui_2.0.0
  • 2.0.0
  • bgs_console_2.0.0
  • bgs_matlab_win64_2.0.0
  • bgs_qtgui_2.0.0
  • v1.9.2_x86_mfc_gui
  • v1.9.2_x64_java_gui
  • v1.9.2_x86_java_gui
23 results

VideoCapture.cpp

  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    VideoCapture.cpp 8.14 KiB
    /*
    This file is part of BGSLibrary.
    
    BGSLibrary is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    BGSLibrary is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with BGSLibrary.  If not, see <http://www.gnu.org/licenses/>.
    */
    #include "VideoCapture.h"
    #include <opencv2/highgui/highgui_c.h>
    
    namespace bgslibrary
    {
      namespace VC_ROI
      {
        IplImage* img_input1 = 0;
        IplImage* img_input2 = 0;
        int roi_x0 = 0;
        int roi_y0 = 0;
        int roi_x1 = 0;
        int roi_y1 = 0;
        int numOfRec = 0;
        int startDraw = 0;
        bool roi_defined = false;
        bool use_roi = true;
        bool disable_event = false;
    
        void reset(void)
        {
          disable_event = false;
          startDraw = false;
        }
    
        void VideoCapture_on_mouse(int evt, int x, int y, int flag, void* param)
        {
          if (use_roi == false || disable_event == true)
            return;
    
          if (evt == CV_EVENT_LBUTTONDOWN)
          {
            if (!startDraw)
            {
              roi_x0 = x;
              roi_y0 = y;
              startDraw = 1;
            }
            else
            {
              roi_x1 = x;
              roi_y1 = y;
              startDraw = 0;
              roi_defined = true;
              disable_event = true;
            }
          }
    
          if (evt == CV_EVENT_MOUSEMOVE && startDraw)
          {
            //redraw ROI selection
            img_input2 = cvCloneImage(img_input1);
            cvRectangle(img_input2, cvPoint(roi_x0, roi_y0), cvPoint(x, y), CV_RGB(255, 0, 0), 1);
            cvShowImage("Input", img_input2);