How to detect wide ball in cricket using MATLAB. What should be the simple code for it.
3 views (last 30 days)
Show older comments
I have deficulty in writing matlab code for detection of wide ball in cricket.
6 Comments
Awais Qarni
on 3 Jan 2023
Video is of our own choice ,from Google as well .only detection of wide ball is important.video could be a few seconds showing balling of the bowler and the program will determine whether it is wide ball or not .
Bjorn Gustavsson
on 3 Jan 2023
@Awais, as far as I understand it is necessary to know the ball's trajectory explicitly in 3-D in order to judge whether the ball is wide or not. To do that one would prefer to have at least bi-static videos with well known camera-parameters in order to do steroscopic triangulation. Lacking that you might get good enough estimate of the distance-from-camera from the known size of the ball - provided you have some very good image of a well known object (wicket should do, I think). If you have a video above from behind the bowler it should also work - but now we're starting to use domain-specific inferences, and my domain-specific knowledge on cricket is pretty much used up by writing "wicket" and "bowler".
Answers (2)
Image Analyst
on 3 Jan 2023
Edited: Image Analyst
on 3 Jan 2023
You need to segment each video frame to detect the ball. If it's moving fast, then it will be blurred or faint/transparent and you probably can't get an accurate size, at least in the direction of motion.
If you have any more questions, then attach your one of your frames with the ball in it and code to read it in with the paperclip icon after you read this:
For an example of how to find a contrasting round object in an image, see my Image Processing Tutorial in my File Exchange:
where I find coins and get their location and diameter.
Bjorn Gustavsson
on 4 Jan 2023
One thing you can (should) try is to look at the differences between frames, that is subtract the previous frame from the current frame. That will hopefully effectively remove everything that is not moving rapidly between frames (should be almost everything except the bowlers arm). In order to do this you better convert the frames from uint8 or whatever data-type you get the individual frames into doubles. That will make most of the difference-frame close to zero and the ball a positive-negative double-hump, positive where it is in the current frame and negative where it was in the previous frame. That way you can extract the position and trajectory of the ball along the video-sequence.
HTH
3 Comments
Bjorn Gustavsson
on 5 Jan 2023
@Image Analyst, true. In most cases where I typically don't know which direction things are moving, I have found it useful to have the positive-negative bumps as a Q-D indicator of what direction things move in. That might not be too important here when that is more or less given (right?).
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!