Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

how to remove green ground from a soccer footage

$
0
0
Hi all, I am trying to perform player and ball tracking from video footage. How having some issues. Below is a sample code: Mat grayInputimage = Mat(size(inputImage),CV_8UC1); int blue,green, red; cvtColor(inputImage,grayInputimage, CV_BGR2GRAY); for (int i = 0; i < inputImage.rows; i++) { for (int j = 0; j < inputImage.cols; j++) { blue = inputImage.at(i, j)[0]; green = inputImage.at(i, j)[1]; red = inputImage.at(i, j)[2]; if (green > red && (green > blue && red > blue) ) { grayInputimage.at(i, j) = 0; } else { grayInputimage.at(i, j) = 1; } } } The input image is the frame from the video, while the grayimage should be image without the ground color green of the football pitch. However am getting this result. I will like if anyone can help.

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>