Directly call opencv in MATLAB

Source: Internet
Author: User

I have seen it in an excellent computer vision blog. I want to use it this time and write down this website:

Http://www.cs.stonybrook.edu /~ Kyamagu/mexopencv/

Children's shoes are required.

Initial Experience:

My environment is win7 + vs2010 + MATLAB 2011b + opencv2.4.5

Download the mexopencv-master.zip file, press readme. markdown, and enter the command in matlab1b.

> Mexico opencv. Make ('opencv _ path', 'd: \ Program Files \ opencv244 ')

Bytes ----------------------------------------------------------------------------------------------

If vs2008 is used, a message indicating a missing file is displayed.

'Stdint. H': no such file or directory

You can find the header file in the include folder of the mexopencv-master file:

Http://msinttypes.googlecode.com/svn/trunk/stdint.h

Bytes ----------------------------------------------------------------------------------------------

After the Mex operation is successful, the following information is provided:

To finish the setup, add opencv bin folder to the systempath, then restart MATLAB for changes to take effect. set Path = % PATH %; D: \ Program Files \ opencv \ build \ x64 \ VC10 \ binto use mexopencv, add its root folder to MATLAB search path.

After setting environment variables, run the following example to report an error (probably because the classifier 'haarcascade _ frontalface_alt.xml' does not exist ):

 

 
% Load a face detector and an imagedetector = CV. cascadeclassifier ('haarcascade _ frontalface_alt.xml'); Im = imread('myface.jpg '); % preprocessgr = CV. cvtcolor (IM, 'rgb2gray '); GR = CV. equalizehist (GR); % detectboxes = detector. detect (GR, 'Scale', 1.3 ,... 'minneighbors', 2 ,... 'minsize', [30, 30]); % draw resultsimshow (IM); for I = 1: numel (boxes) rectangle ('position ', boxes {I },... 'gecolor', 'G'); End

The error is as follows:

Error Using cascadeclassifier_invalid path or file specifiederror in cv. cascadeclassifier (Line 33) This. ID = cascadeclassifier _ (filename );

You can run the following 2nd examples:

 
% Wocould you like to use a camera input? No problem. camera = CV. videocapture (); pause (2); for I = 1:50% capture and show frame = camera. read; imshow (FRAME); pause (0.3); End

Enter this line in MATLABCode, You can also run:

> Hog = cv. hogdescriptor ();


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.