Go to Post there should be a continuous cascade of knowledge spilling over to the less experienced team members and and continuous upward flow of members gaining experience. - ebarker [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-02-2016, 16:20
Bernstern Bernstern is offline
Registered User
FRC #2141 (Spartonics)
Team Role: Programmer
 
Join Date: Nov 2015
Rookie Year: 2015
Location: Clayton
Posts: 30
Bernstern is an unknown quantity at this point
trying to use usb webcam with opencv

Hello,

My team has been trying to use the Tower tracker program to little avail, but our hardest challenge is using our Microsoft webcam as the vision input. I checked out mjpeg streamer but couldn't understand it and have gotten no where with it. Any help would be greatly appreciated/
__________________
Programmers, a species indigenous to robotics that can convert caffeine into code.
Reply With Quote
  #2   Spotlight this post!  
Unread 21-02-2016, 18:46
Noviv's Avatar
Noviv Noviv is offline
Registered User
FRC #1477 (Texas Torque)
Team Role: Programmer
 
Join Date: Jun 2015
Rookie Year: 2013
Location: Texas
Posts: 5
Noviv is an unknown quantity at this point
Re: trying to use usb webcam with opencv

My team isn't using the Tower Tracker program, so I can't help you with that, sorry.

But, if you are using OpenCV in C/C++, all you should have to do is declare a new VideoCapture and use the Mat that you get from the device. You can then play around with the Mat using OpenCV functions (just google what you want to do).

Code:
#include "opencv2/opencv.hpp"

int main() {
    VideoCapture cap(0);
    Mat frame;

    namedWindow("Webcam");

    while (true) {
        cap >> frame;

        //opencv functions go here

        imshow("Webcam", frame);
        if (waitKey(30) >= 0) {
            break;
        }
    }

    cap.release();
}
If you have another webcam on the computer/device you are running this program on, just increase 0 to 1, 2, etc until you get the right device.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:10.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi