opencv3.0 compilation installation (ubuntu14.04 system), OPENCV set camera resolution and capture picture

Source: Internet
Author: User

Build A/C + + compilation environment: sudo apt-get install build-essential

Install the correlation library: sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev py Thon-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev-y

Download good Linux source to the official website and pull to ubuntu14.04 virtual machine to unzip and enter the OpenCV directory, switch to root permission

CMake.

Make

Make install

Three was done, but the make process took a long time. Note that there is a space and a dot behind the cmake above.

Next is the test code, VI img.cpp

/*compile command:g++ img.cpp-lopencv_highgui-lopencv_videoio-lopencv_imgcodecs-o img*/#include<opencv/highgui.h>#include<stdio.h>//using namespace std;//using namespace CV;#defineImage_width 320#defineImage_height 240intMain () {Iplimage*img; Cvcapture* Cap = Cvcreatecameracapture (0);    Cvsetcaptureproperty (Cap, cv_cap_prop_frame_width, image_width);    Cvsetcaptureproperty (Cap, cv_cap_prop_frame_height, image_height); IMG=cvqueryframe (CAP); printf ("width:%d\t height:%d\t widthstep:%d\n", Img->width, Img->height, img->widthstep); Cvsaveimage ("img.jpg", IMG); return 0;}

Compilation: g++ img.cpp-lopencv_highgui-lopencv_videoio-lopencv_imgcodecs-o img

Execution:./img

You can get a picture of a given resolution img.jpg.

opencv3.0 compilation installation (ubuntu14.04 system), OPENCV set camera resolution and capture picture

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.