"Error: samplecb ()-buffer sizes do not match" SOLUTION

Source: Internet
Author: User

I am original. Please mark the reprinted address for reprinting. Http://blog.csdn.net/jia_zhengshen/article/details/9980495

The highgui module of opencv uses the open-source image display function library videoinput in the implementation of windows. However, in order to be compatible with Linux and other systems, the highgui module does not do a good job in the pal module, and it should not support multiple cameras. We can see from the source code that although ideoinput supports multiple cameras, only one videoinput instance can be run in opencv due to the nature of videoinput in the videocapture class being set to "Private Static, therefore, opencv does not support multiple cameras, and because VI is set to private, the nature of this vi cannot be changed.

So I gave up using the videocapture module of opencv directly. Instead, we directly use its underlying videoinput to implement multiple cameras and solve the "error: samplecb ()-buffer sizes do not match" problem.

The procedure is as follows:

1. when downloading the videoinput class library, I encountered a problem. Because it is no longer updated, the highest version of the class library is vs08. I use vs10, the class library compiled by vs08 can be used after the experiment 10.

2. Set various paths, including lib and include. You can see this article.Article.

3. Include the videoinput. h header file.

4. WriteCodeDirectly assign the value of data in the videoinput class to CV: mat or iplimage.

How is QQ implemented? Let's see how he copied it,

What if you press "picture quality control ???????????????

The following is a simple example.

# Pragma comment (linker, "/nodefaultlib: atlthunk. lib") // It is said that the above sentence is indispensable. # Include <iostream> # include "opencv2/opencv. HPP "# include" opencv2/GPU. HPP "# include <opencv2 \ highgui. HPP> using namespace STD; using namespace CV; # include "videoinput. H "int main (INT argc, char * argv []) {videoinput: listdevices (); // list all cameras that the system can find. videoinput * Vi = new videoinput (); int device = 1; // device No. // vi-> setphycon (0, vi_composite ); VI-> setupdevice (device); // open the device vi-> setformat (device, vi_pal_ B );/ /The camera I use is in the pal_ B format, so you can choose not to set it to this format. VI-> showsettingswindow (device); // use the widows dialog box to set the camera format. It can replace the sentence that fell above., Open the QQ picture quality adjustment, found that your dialog box is the same as QQ actually ????? // Originally, QQ was implemented using ideoinput. Int Height = vi-> getheight (device); int width = vi-> getwidth (device ); cout <"height" 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.