Paper 69:haar-like Rectangle Traversal Detection window demo MATLAB source code [reprint]

Source: Internet
Author: User

Haar-like Rectangle Traversal Detection window demonstrates MATLAB source code
CLC Clear                                                Close all;% haar-like feature Rectangle Calculation board = 24 detection window Width num = 24                                               % Detection window split number show = 1;                                           % 1 is plotted time = 0.001; % drawing Interval%%if mod (board,num) ~=0 error (' Detection window width must be an integer multiple of the number of partitions ') else Delta = board/num% sliding step Input end%% Haar feature 1: Zobai, right black, (s,t) = (n) s = 1;t = 2;                                 R = S:s:floor (num/s) *s;                                 % Haar window High c = T:t:floor (num/t) *t;                                                % Haar window Width num = 0;                                   % Haar feature Total '----haar feature 1: Zobai, right black, (s,t) = (---' for I = 1:length (R) for J = 1:length (C) R = R (I) *delta;                                  % Haar window High c = C (J) *delta;                                 % Haar window Width nr = num-r (I) +1;                                 % moving number in line direction NC = num-c (J) +1; Number of moves in the% column direction               Px0 = [0 R];        % Rectangle coordinate initialization Py0 = [0 c/2 c];                    For i = 1:nr for j = 1:nc Px = px0+ (i-1) *delta;                % sliding Pick-point Py = py0+ (j-1) *delta;                               NUM = num+1; If show plot ([0 Board],repmat ((0:delta:board) ', +), ' K ');                    Hold on; Plot (Repmat (0:delta:board), [0 board], ' K '); Axis tight;                    Axis Square;                                       Title (' Haar Rectangle traversal demo '); Xlabel (' x '); Ylabel (' Y '); Plot (Px,repmat (py '), ' R ', ' LineWidth ', 5) plot (Repmat (px,2,1), Repmat ([py (1) PY (end)] ', "), ' R ', ' Linewi DTH ', 5); Hold off pause (time) end End end endendnum%% Haar feature 2: Upper White, Lower black, (s,t) = (2,1) s = 2;t = 1;                                 R = S:s:floor (num/s) *s;                                 % Haar window High c = T:t:floor (num/t) *t; % Haar windowPort width num = 0;                                  % Haar feature Total '----haar feature 2: Upper White, Lower black, (s,t) = (2,1)---' for I = 1:length (r) for J = 1:length (C) R = R (I) *delta;                                  % Haar window High c = C (J) *delta;                                 % Haar window Width nr = num-r (I) +1;                                 % moving number in line direction NC = num-c (J) +1;                                 Px0 = [0 R/2 R] in the direction of movement of the% column        % Rectangle coordinate initialization Py0 = [0 c];                    For i = 1:nr for j = 1:nc Px = px0+ (i-1) *delta;                % sliding Pick-point Py = py0+ (j-1) *delta;                NUM = num+1; If show plot ([0 Board],repmat ((0:delta:board) ', +), ' K ');                    Hold on; Plot (Repmat (0:delta:board), [0 board], ' K '); Axis tight;                    Axis Square;                                       Title (' Haar Rectangle traversal demo '); Xlabel (' x '); Ylabel (' Y '); Plot (Repmat (px,2,1),Repmat (Py ', 1,length (Px)), ' R ', ' LineWidth ', 3); Plot (Repmat ([px (1) PX (end)] ', "Repmat" (py,2,1), ' R ', ' LineWidth ', 3); Hold off pause (time) end End end endendnum%% Haar feature 3: Left and right white, middle black, (s,t) = (1,3) s = 1;t = 3;                                 R = S:s:floor (num/s) *s;                                 % Haar window High c = T:t:floor (num/t) *t;                                                % Haar window Width num = 0;                                  % Haar feature Total '----Haar feature 3: Left and right white, middle black, (s,t) = (1,3)---' for I = 1:length (r) for J = 1:length (C) R = R (I) *delta;                                  % Haar window High c = C (J) *delta;                                 % Haar window Width nr = num-r (I) +1;                                 % moving number in line direction NC = num-c (J) +1;                                     The number of Px0 = [0 R] in the direction of the moving column;        % Rectangle coordinate initialization Py0 = [0 C/3 C*2/3 C];            For i = 1:nr for j = 1:nc    Px = px0+ (i-1) *delta;                % sliding Pick-point Py = py0+ (j-1) *delta;                               NUM = num+1; If show plot ([0 Board],repmat ((0:delta:board) ', +), ' K ');                    Hold on; Plot (Repmat (0:delta:board), [0 board], ' K '); Axis tight;                    Axis Square;                                       Title (' Haar Rectangle traversal demo '); Xlabel (' x '); Ylabel (' Y '); Plot (Px,repmat (py '), ' R ', ' LineWidth ', 5) plot (Repmat (px,2,1), Repmat ([py (1) PY (end)] ', "), ' R ', ' Linewi DTH ', 5); Hold off pause (time) end End end endendnum%% Haar feature 4: White Around, middle black (twice times width), (s,t) = (1,4) s = 1;t = 4;                                 R = S:s:floor (num/s) *s;                                 % Haar window High c = T:t:floor (num/t) *t;                                                % Haar window Width num = 0;      % Haar feature Total '----Haar feature 4: Left and right white, middle black (twice times width), (s,t) = (1,4)---' for I = 1:length (R) for J = 1:length (C)         R = R (I) *delta;                                  % Haar window High c = C (J) *delta;                                 % Haar window Width nr = num-r (I) +1;                                 % moving number in line direction NC = num-c (J) +1;                                     The number of Px0 = [0 R] in the direction of the moving column;        % Rectangle coordinate initialization Py0 = [0 C/4 C*3/4 C];                    For i = 1:nr for j = 1:nc Px = px0+ (i-1) *delta;                % sliding Pick-point Py = py0+ (j-1) *delta;                       NUM = num+1; If show plot ([0 Board],repmat ((0:delta:board) ', +), ' K ');                    Hold on; Plot (Repmat (0:delta:board), [0 board], ' K '); Axis tight;                    Axis Square;                                       Title (' Haar Rectangle traversal demo '); Xlabel (' x '); Ylabel (' Y '); Plot (Px,repmat (py '), ' R ', ' LineWidth ', 5) plot (Repmat (px,2,1), Repmat ([py (1) PY (end)] ', "), ' R ', ' Linewi DTH ', 5);                Hold off    Pause (time) end End end endendnum%% Haar feature 5: Upper and lower white, middle black, (s,t) = (3 , 1) s = 3;t = 1;                                 R = S:s:floor (num/s) *s;                                 % Haar window High c = T:t:floor (num/t) *t;                                                % Haar window Width num = 0;                                  % Haar feature Total '----haar feature 5: Upper and lower white, middle black, (s,t) = (3,1)---' for I = 1:length (r) for J = 1:length (C) R = R (I) *delta;                                  % Haar window High c = C (J) *delta;                                 % Haar window Width nr = num-r (I) +1;                                 % moving number in line direction NC = num-c (J) +1;                           The number of Px0 = [0 r/3 R*2/3 R];        % Rectangle coordinate initialization Py0 = [0 c];                    For i = 1:nr for j = 1:nc Px = px0+ (i-1) *delta;                % sliding Pick-point Py = py0+ (j-1) *delta;                               NUM = num+1;             If show       Plot ([0 Board],repmat ((0:delta:board) ', +), ' K ');                    Hold on; Plot (Repmat (0:delta:board), [0 board], ' K '); Axis tight;                    Axis Square;                                       Title (' Haar Rectangle traversal demo '); Xlabel (' x '); Ylabel (' Y ');                    Plot (Repmat (px,2,1), Repmat (Py ', 1,length (Px)), ' R ', ' LineWidth ', 3); Plot (Repmat ([px (1) PX (end)] ', "Repmat" (py,2,1), ' R ', ' LineWidth ', 3); Hold off pause (time) end End end endendnum%% Haar feature 6: Upper and lower white, middle black (twice times width), (s,t) = (4,1) s = 4;t = 1;                                 R = S:s:floor (num/s) *s;                                 % Haar window High c = T:t:floor (num/t) *t;                                                % Haar window Width num = 0; % Haar feature Total '----haar feature 6: Upper and lower white, middle black (twice times width), (s,t) = (4,1)---' for I = 1:length (R) for J = 1:length (C) R = R (I) *de                                  Lta                                 % Haar window High c = C (J) *delta; % Haar windowMouth width nr = num-r (I) +1;                                 % moving number in line direction NC = num-c (J) +1;                           The number of Px0 = [0 r/4 R*3/4 R];        % Rectangle coordinate initialization Py0 = [0 c];                    For i = 1:nr for j = 1:nc Px = px0+ (i-1) *delta;                % sliding Pick-point Py = py0+ (j-1) *delta;                NUM = num+1; If show plot ([0 Board],repmat ((0:delta:board) ', +), ' K ');                    Hold on; Plot (Repmat (0:delta:board), [0 board], ' K '); Axis tight;                    Axis Square;                                       Title (' Haar Rectangle traversal demo '); Xlabel (' x '); Ylabel (' Y ');                    Plot (Repmat (px,2,1), Repmat (Py ', 1,length (Px)), ' R ', ' LineWidth ', 3); Plot (Repmat ([px (1) PX (end)] ', "Repmat" (py,2,1), ' R ', ' LineWidth ', 3); Hold off pause (time) end End end endendnum%% Haar feature 7: Left upper right lower white, other black, (s,s) = (2,2) s = 2;t = 2;                                 R = S:s:floor (num/s) *s;                                 % Haar window High c = T:t:floor (num/t) *t;                                                % Haar window Width num = 0;                                   % Haar feature Total '----Haar feature 7: Left upper right lower white, other black, (s,s) = (2,2)---' for I = 1:length (r) for J = 1:length (C) R = R (I) *delta;                                  % Haar window High c = C (J) *delta;                                 % Haar window High nr = Num-r (I) +1;                                 % moving number in line direction NC = num-c (J) +1;                           % moving number Px0 = [0 r/2 R];                           % Rectangle coordinate initialization Py0 = [0 c/2 c];                    The% rectangle coordinates are initialized for i = 1:nr for j = 1:nc Px = px0+ (i-1) *delta;                % sliding Pick-point Py = py0+ (j-1) *delta;                               NUM = num+1; If show plot ([0 Board],repmat ((0:delta:board) ', +), ' K ');                    Hold on; PloT (Repmat (0:delta:board) ', up to), [0 board], ' K '); Axis tight;                    Axis Square;                                       Title (' Haar Rectangle traversal demo '); Xlabel (' x '); Ylabel (' Y ');                    Plot (Repmat (px,3,1), Repmat (Py ', 1,length (Px)), ' R ', ' LineWidth ', 3); Plot (Repmat ([px (1) PX (end)] ', 1,3), Repmat (py,2,1), ' R ', ' LineWidth ', 3); Hold off pause (time) end End end endendnum%% Haar feature 8: Around white, middle black, (s,s) = (3,3) s = 3;t = 3;                                 R = S:s:floor (num/s) *s;                                 % Haar window High c = T:t:floor (num/t) *t;                                                % Haar window Width num = 0;                                  % Haar feature Total '----Haar feature 8: Around white, middle black, (s,s) = (3,3)---' for I = 1:length (r) for J = 1:length (C) R = R (I) *delta;                                  % Haar window High c = C (J) *delta;                                 % Haar window High nr = Num-r (I) +1;       % moving number in line direction NC = num-c (J) +1;                          % moving number Px0 = [0 r/3 R*2/3 R];                           % Rectangle coordinate initialization Py0 = [0 C/3 C*2/3 C];                    The% rectangle coordinates are initialized for i = 1:nr for j = 1:nc Px = px0+ (i-1) *delta;                % sliding Pick-point Py = py0+ (j-1) *delta;                               NUM = num+1; If show plot ([0 Board],repmat ((0:delta:board) ', +), ' K ');                    Hold on; Plot (Repmat (0:delta:board), [0 board], ' K '); Axis tight;                    Axis Square;                                       Title (' Haar Rectangle traversal demo '); Xlabel (' x '); Ylabel (' Y ');                    Plot (Repmat (px,4,1), Repmat (Py ', 1,length (Px)), ' R ', ' LineWidth ', 3); Plot (Repmat ([px (1) PX (end)] ', 1,4), Repmat (py,2,1), ' R ', ' LineWidth ', 3); Hold off pause (time) end End end endendnum% Academy: Naval Engineering University, Water Sound Engineering, PhD% Mastery Direction: Digital signal (image, video) processing, artificial intelligence and pattern recognition, swarm intelligence optimization, nonlinear and chaos, supportVector machine, matlab and VC + + mixed current position: Shenyang Poly-German Video Technology Co., Ltd., image processing and pattern recognition research and development engineer% job Responsibilities: License plate recognition, video target tracking algorithm development, C + + implementation, DSP implant% Interests: the main results of the modular trading of financial timing: % [1] achieve license plate recognition C/C implementation, DSP implantation, recognition rate: Chinese characters not less than 99%, the number of letters not less than 99.5%, the entire card is not less than 97% [2] proficient in digital signal (image, video) "Feature extraction" and "pattern recognition" research and development, the "Support Vector Machine" application research, The original article has "four kinds of support Vector machine Toolbox use points", independently developed "Support vector machine matlab Toolbox Version1.0". Knot items are: speech signal processing and recognition, remote sensing image feature extraction and classification, face recognition, the main passive sonar signal processing and recognition, etc. [3] proficient in "swarm intelligence optimization", the original toolbox has "swarm Intelligence algorithm" MATLAB Toolbox Version2.0 ", The error accuracy is superior to the existing published literature, and the optimization calculation of various high-dimensional complex problems is solved in engineering.% [4] Proficient in "time series chaotic modeling and prediction", based on MATLAB and VC mixed platform, the chaotic analysis and prediction software package "Chaotic time series Analysis and prediction Toolbox Version2.9" was developed independently. ”。 The project has: financial data volatility analysis and stylized transactions, bank anti-money laundering anomaly detection system, chaotic background weak signal detection, marine reverberation background weak target detection, etc.% [5] proficient in MATLAB and VC mixed programming: (a) VC as the interface, the core algorithm using MATLAB function, the original article has " How to convert the Matlab7.0 function to VC 6.0 dynamic link library; (b) using Matlab as interface, time-consuming algorithm uses mexfunction to compile in VC environment. Percent of contact information

Reprint Source: http://blog.sina.com.cn/s/blog_736aa0540101kzqb.html

Personal blog: Http://blog.sina.com.cn/luzhenbo2

Paper 69:haar-like Rectangle Traversal Detection window demo MATLAB source code [reprint]

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.