1、HS算法
#include "cv.h"
#include "highgui.h"
#include <math.h>
#include <stdio.h>
#include "opencv2/legacy/legacy.hpp"
#define CVX_GRAY50 cvScalar(100)
#define CVX_WHITE cvScalar(255)
int main(int argc, char** argv)
{
// Initialize, load two images from the file system, and
// allocate the images and other structures we will need for
// results.
// exit if no input images
IplImage *imgA = 0, *imgB = 0;
//imgA = cvLoadImage("OpticalFlow0.jpg",0);
//imgB = cvLoadImage("OpticalFlow1.jpg",0);
//if(!(imgA)||!(imgB)){ printf("One of OpticalFlow0.jpg and/or OpticalFlow1.jpg didn't load\n"); return -1;}
imgA = cvLoadImage("OpticalFlow0.jpg",0);
imgB = cvLoadImage("OpticalFlow1.jpg",0);
if(!(imgA)||!(imgB)){ printf("One of OpticalFlow0.jpg and/or OpticalFlow1.jpg didn't load\n"); return -1;}
IplImage* velx = cvCreateImage(cvGetSize(imgA),IPL_DEPTH_32F,1);
IplImage* vely = cvCreateImage(