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 ();