This mean is surf and sift is not free, give the money to use in commercially.
But how to know using this lib or not?
em..
I don't know.
Thank you.
void main() { VideoCapture stream1(0); //0 is the id of video device.0 if you have only one camera VideoCapture stream2(1); //0 is the id of video device.0 if you have only one camera if (!stream1.isOpened()) { //check if video device has been initialised cout << "cannot open camera 1"; } if (!stream2.isOpened()) { //check if video device has been initialised cout << "cannot open camera 2"; } namedWindow("Processing"); namedWindow("CAM1"); namedWindow("CAM2"); //unconditional loop while (true) { Mat cameraFrame1; stream1.read(cameraFrame1); //get one frame form video imshow("CAM1", cameraFrame1); Mat cameraFrame2; stream2.read(cameraFrame2); //get one frame form video imshow("CAM2", cameraFrame2); if (waitKey(30) >= 0) break; } destroyAllWindows(); }/////
void main() { VideoCapture stream1(1); //0 is the id of video device.0 if you have only one camera if (!stream1.isOpened()) { //check if video device has been initialised cout << "cannot open camera"; } namedWindow("Processing"); namedWindow("Origin"); //unconditional loop while (true) { Mat cameraFrame; stream1.read(cameraFrame); //get one frame form video imshow("Origin", cameraFrame); Sobel(cameraFrame, cameraFrame, CV_8U, 1, 0); //sobel processing imshow("Processing",cameraFrame); if (waitKey(30) >= 0) break; } destroyAllWindows(); }...
http://study.marearts.com/2013/09/opencv-make-histogram-and-draw-example.html | |
#include "opencv2/opencv.hpp" | |
#include "opencv2\highgui.hpp" | |
#include <iostream> | |
#ifdef _DEBUG | |
#pragma comment(lib, "opencv_core331d.lib") | |
#pragma comment(lib, "opencv_highgui331d.lib") | |
#pragma comment(lib, "opencv_imgcodecs331d.lib") | |
#pragma comment(lib, "opencv_objdetect331d.lib") | |
#pragma comment(lib, "opencv_imgproc331d.lib") | |
#pragma comment(lib, "opencv_videoio331d.lib") | |
#else | |
#pragma comment(lib, "opencv_core331.lib") | |
#pragma comment(lib, "opencv_highgui331.lib") | |
#pragma comment(lib, "opencv_imgcodecs331.lib") | |
#pragma comment(lib, "opencv_objdetect331.lib") | |
#pragma comment(lib, "opencv_imgproc331.lib") | |
#pragma comment(lib, "opencv_videoio331.lib") | |
#endif | |
using namespace std; | |
using namespace cv; | |
Mat mareHistogram(Mat& img, int t) | |
{ | |
//col or row histogram? | |
int sz = (t) ? img.rows : img.cols; | |
Mat mhist = Mat::zeros(1, sz, CV_8U); | |
//count nonzero value and check max V | |
int max = -100; | |
for (int j = 0; j < sz; ++j) | |
{ | |
Mat data = (t) ? img.row(j) : img.col(j); | |
int v = countNonZero(data); | |
mhist.at< unsigned char >(j) = v; | |
if (v > max) | |
max = v; | |
} | |
Mat histo; | |
int width, height; | |
if (t) | |
{ | |
width = max; | |
height = sz; | |
histo = Mat::zeros(Size(width, height), CV_8U); | |
for (int i = 0; i < height; ++i) | |
{ | |
for (int j = 0; j < mhist.at< unsigned char >(i); ++j) | |
histo.at< unsigned char >(i, j) = 255; | |
} | |
} | |
else { | |
width = sz; | |
height = max; | |
histo = Mat::zeros(Size(width, height), CV_8U); | |
for (int i = 0; i< width; ++i) | |
{ | |
for (int j = 0; j< mhist.at< unsigned char >(i); ++j) | |
histo.at< unsigned char >(max - j - 1, i) = 255; | |
} | |
} | |
return histo; | |
} | |
void main() | |
{ | |
Mat img; | |
img = imread(".\\number.jpg", 0); | |
threshold(img, img, 128, 255, CV_THRESH_BINARY); | |
//0 horizontal(width), 1 vertical(height) | |
Mat hHisto = mareHistogram(img, 0); | |
Mat vHisto = mareHistogram(img, 1); | |
imshow("origin", img); | |
imshow("hh", hHisto); | |
imshow("vv", vHisto); | |
waitKey(0); | |
} |
int main() { VideoCapture capture("rhinos.avi"); Mat frame; //Set properties int askFileTypeBox = 0; //-1 is show box of codec int Color = 1; Size S = Size((int)capture.get(CV_CAP_PROP_FRAME_WIDTH), (int)capture.get(CV_CAP_PROP_FRAME_HEIGHT)); //make output video file VideoWriter outVideo; //save video file by origin paramers outVideo.open(".\\outVideo.avi", askFileTypeBox, capture.get(CV_CAP_PROP_FPS), S, Color); double fps = capture.get(CV_CAP_PROP_FPS); //check if (!capture.isOpened()) { printf("AVI file can not open.\n"); return 0; } //create window namedWindow("w"); while (1) { //grab frame from file & throw to Mat capture >> frame; if (frame.empty()) //Is video end? break; //processing example //Sobel(frame, frame, frame.depth(), 1, 0); //////////////////// //outVideo.write(frame); outVideo << frame; //display and delay imshow("w", frame); //delay by origin fps if (waitKey((1 / fps) * 1000) > 0) break; } return 0; }...
//file load VideoCapture capture(".\\video.avi"); Mat frame; //check if( !capture.isOpened() ) { printf("AVI file can not open.\n"); return; } //create window namedWindow("w"); while(1) { //grab frame from file & throw to Mat capture >> frame; if(frame.empty() ) //Is video end? break; //processing example Sobel(frame,frame,frame.depth(),1,0); //////////////////// //display and delay imshow("w", frame); if(waitKey(10) > 0) break; }...