Video Analysis – OpenCV Test

Mój starty projekt analizy wideo przy pomocy OpenCV. Na filmie widać 2 algorytmy
  • Candy algorithm
  • Sobel algorithm
Poniżej film jak to wyglądało w ruchu i screen. Cały projekt znajduje się poniżej i na GitHub. https://github.com/DarkGL3/Video-Analysis 1010024_541489019246379_1706694390_n (1)
Przykładowy kod
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
cv::Mat edges;
cv::GaussianBlur( frame, edges, cv::Size(3,3), 0, 0, cv::BORDER_DEFAULT );
cv::cvtColor( edges, edges, CV_RGB2GRAY );
cv::Mat grad_x, grad_y;
cv::Mat abs_grad_x, abs_grad_y;
cv::Sobel( edges, grad_x, CV_16S, 1, 0, 3, 1, 0, cv::BORDER_DEFAULT );
cv::Sobel( edges, grad_y, CV_16S, 0, 1, 3, 1, 0, cv::BORDER_DEFAULT );
cv::convertScaleAbs( grad_x, abs_grad_x );
cv::convertScaleAbs( grad_y, abs_grad_y );
cv::addWeighted( abs_grad_x, 0.5, abs_grad_y, 0.5, 0, edges );
cv::imshow( windowName, edges );
cv::Mat edges; cv::GaussianBlur( frame, edges, cv::Size(3,3), 0, 0, cv::BORDER_DEFAULT ); cv::cvtColor( edges, edges, CV_RGB2GRAY ); cv::Mat grad_x, grad_y; cv::Mat abs_grad_x, abs_grad_y; cv::Sobel( edges, grad_x, CV_16S, 1, 0, 3, 1, 0, cv::BORDER_DEFAULT ); cv::Sobel( edges, grad_y, CV_16S, 0, 1, 3, 1, 0, cv::BORDER_DEFAULT ); cv::convertScaleAbs( grad_x, abs_grad_x ); cv::convertScaleAbs( grad_y, abs_grad_y ); cv::addWeighted( abs_grad_x, 0.5, abs_grad_y, 0.5, 0, edges ); cv::imshow( windowName, edges );
cv::Mat edges;

cv::GaussianBlur( frame, edges, cv::Size(3,3), 0, 0, cv::BORDER_DEFAULT );
cv::cvtColor( edges, edges, CV_RGB2GRAY );

cv::Mat grad_x, grad_y;
cv::Mat abs_grad_x, abs_grad_y;

cv::Sobel( edges, grad_x, CV_16S, 1, 0, 3, 1, 0, cv::BORDER_DEFAULT );
cv::Sobel( edges, grad_y, CV_16S, 0, 1, 3, 1, 0, cv::BORDER_DEFAULT );

cv::convertScaleAbs( grad_x, abs_grad_x );
cv::convertScaleAbs( grad_y, abs_grad_y );

cv::addWeighted( abs_grad_x, 0.5, abs_grad_y, 0.5, 0, edges );

cv::imshow( windowName, edges );
Video Analysis 2.zip Download

Dodaj komentarz

This site uses Akismet to reduce spam. Learn how your comment data is processed.