How to detect wide ball in cricket using MATLAB. What should be the simple code for it.

I have deficulty in writing matlab code for detection of wide ball in cricket.

6 Comments

What data you have? Is it from a video or a image?
Is it a specific, single video, or is it any one of many videos that might need to be processed? How is the video framed? Is the camera position constant? If more than one video is used, do these conditions vary between videos?
If your file is small enough (<5MB) you can attach it. Otherwise, a link to the video offsite would help. I don't do much with video, but I'm sure anybody who does will want an example.
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 .
@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".

Sign in to comment.

Answers (2)

@Muhammad and @Awais Qarni (are you working together on this project?)
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.
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

@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?).

Sign in to comment.

Products

Release

R2020a

Asked:

on 3 Jan 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!