-
-
Save liuchang0812/5382774 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QCoreApplication> | |
#include "highgui.h" | |
#include "cv.h" | |
#include <vector> | |
#include <stdio.h> | |
#include <iostream> | |
using namespace std ; | |
using namespace cv ; | |
vector< vector<int> > f1 , f2 ; //直方图 | |
vector<int> getHist(IplImage *img) | |
{ | |
vector<int> tmp(10) ; | |
int h , w ; | |
h = img->height ; | |
w = img->width ; | |
for ( int i = 0;i < h;i ++) | |
for ( int j = 0;j < w;j ++) | |
{ | |
CvScalar s = cvGet2D (img,i , j ) ; | |
tmp[s.val[0] / 26] ++ ; | |
} | |
for ( int i = 0;i < 10;i ++) | |
printf("%d %d\n" , i , tmp[i]) ; | |
return tmp ; | |
} | |
vector<vector<int> > getHistList(char* filename) | |
{ | |
vector<vector<int> > tmp ; | |
CvCapture* capture = cvCreateFileCapture (filename) ; | |
IplImage* frame ; | |
while (1) { | |
frame = cvQueryFrame (capture) ; | |
if (!frame) break ; | |
tmp.push_back( getHist(frame)) ; | |
} | |
cvReleaseCapture(&capture) ; | |
return tmp ; | |
} | |
int main2(int argc, char *argv[]) | |
{ | |
//QCoreApplication a(argc, argv); | |
/* | |
char* filename1 = "D:\\Wildworld.wmv" ; | |
char* filename2 = "D:\\Wildworld2.wmv" ; | |
IplImage* img = cvLoadImage ("D:\\flag.jpg") ; | |
getHist(img) ; | |
*/ | |
cout << "hello world!"<<endl; | |
//return a.exec(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment