Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8794005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:11:41+00:00 2026-06-13T23:11:41+00:00

I am trying to capture video into a Mat type from two or more

  • 0

I am trying to capture video into a Mat type from two or more MSFT LifeCam HD-3000s using the videoInput library, OpenCV 2.4.3, and VS2010 Express.

I followed the example at: Most efficient way to capture and send images from a webcam in a network and it worked great.

Now I want to replace the IplImage type with a c++ Mat type. I tried to follow the example at: opencv create mat from camera data

That gave me the following:

    VI = new videoInput;
    int CurrentCam = 0;
    VI->setupDevice(CurrentCam,WIDTH,HEIGHT);
    int width = VI->getWidth(CurrentCam);
    int height = VI->getHeight(CurrentCam);
    unsigned char* yourBuffer = new unsigned char[VI->getSize(CurrentCam)];
    cvNamedWindow("test",1);
    while(1)
    {
       VI->getPixels(CurrentCam, yourBuffer, false, true);
       cv::Mat image(width, height, CV_8UC3, yourBuffer, Mat::AUTO_STEP);
       imshow("test", image); 
       if(cvWaitKey(15)==27) break;
    }

The output is a lined image (i.e., it looks like the first line is correct but the second line seems off, third correct, fourth off, etc). That suggests that either the step part is wrong or there is some difference between the IplImage type and the Mat type that I am not getting. I have tried looking at/altering all the parameters, but I can’t find anything.

Hopefully, an answer will help those facing what appears to be a fairly common issue with loading an image form the videoInput library to the Mat type.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:11:42+00:00Added an answer on June 13, 2026 at 11:11 pm

    Try

    cv::Mat image(height, width, CV_8UC3, yourBuffer, Mat::AUTO_STEP);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement video capture in my app using AVFoundation. I have
I'm trying to display video from a webcam. I capture the images from the
I trying to capture packets using SharpPcap library. I'm able to return the packets
I'm trying to capture packets from two devices on my network. I have tcpdump
I am trying to capture video from a camera. i have gotten the captureOutput:didOutputSampleBuffer:
I downloaded the latest video capture samples from WWDC 2010 and am trying to
I'm new here. I have been trying to create a video capture app using
I am trying to capture a picture from a video on my iPad. I
I'm looking for a flash script/library to capture video and audio from a webcam
I'm trying to stream a live video from a capture device via WCF. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.