Skip to main content

A computer vision package to recognize and assess different cricket shots and bowling videos.

Project description

Cricket

This is a package which can be used for assessing videos of bowling and batting.It is different from cricket as this can work in situations where opencv-python is throwing this type of error:

ImportError: libGL.so.1: cannot open shared object file: No such file or directory

Note: Please add a packages.txt file inside your project having the following data:

libgl1-mesa-glx
libglib2.0-0
libxrender1

Installation

Option 1

Use the command:

pip install cricket-tannmay

Option 2

Go to this link. Then download the source code and requirements.txt and run this command:

pip install -r requirements.txt

How To Use

Note: The name to use while installing is cricket-tannmay but while using it in python we have to import cricket

Batting

Specific Shot

Option 1

This option will give a single string in return telling It will also if it was a:

  • Good shot
  • Bad shot
  • Not the shot the function was called for

This is the implementation for the compatible shots:

  • Straight Drive:
from cricket.batting import straight_drive
decision = straight_drive.classify_entire_video("video_path")
  • Cover drive:
from cricket.batting import cover_drive
decision = cover_drive.classify_entire_video("video_path")
  • Pull shot:
from cricket.batting import pull_shot
decision = pull_shot.classify_entire_video("video_path")
  • Sweep:
from cricket.batting import sweep
decision = sweep.classify_entire_video("video_path")
  • Reverse sweep:
from cricket.batting import reverse_sweep
decision = reverse_sweep.classify_entire_video("video_path")
  • Hook shot:
from cricket.batting import hook_shot
decision = hook_shot.classify_entire_video("video_path")
  • Defense:
from cricket.batting import defense
decision = defense.classify_entire_video("video_path")
Option 2

This will return a dictionary which tells about what it thinks at that frame, whether it is a:

  • Good Shot
  • Bad Shot
  • Not the shot it was called for

This is the implementation for the compatible shots:

  • Straight Drive:
from cricket.batting import straight_drive
decision = straight_drive.analyze_video("video_path")
  • Cover drive:
from cricket.batting import cover_drive
decision = cover_drive.analyze_video("video_path")
  • Pull shot:
from cricket.batting import pull_shot
decision = pull_shot.analyze_video("video_path")
  • Sweep:
from cricket.batting import sweep
decision = sweep.analyze_video("video_path")
  • Reverse sweep:
from cricket.batting import reverse_sweep
decision = reverse_sweep.analyze_video("video_path")
  • Hook shot:
from cricket.batting import hook_shot
decision = hook_shot.analyze_video("video_path")
  • Defense:
from cricket.batting import defense
decision = defense.analyze_video("video_path")

Overall

from cricket.batting import overall_shot_detection
classifier = overall_shot_detection.CricketShotClassifier()
classifier.classify_entire_video("video_path")

This classifier class is compatible with the following shots:

  • Straight Drive
  • Cover Drive
  • Sweep
  • Defence
  • Reverse Sweep
  • Pull Shot
  • Hook Shot

This will also return if it was a:

  • Good Shot
  • Bad Shot

Balling

Specific Type

from cricket.balling import fast
import cricket.utils as utils

ball_colour_range = utils.color_ranges["white"]
decision = fast.classify_entire_video("video_path", ball_colour_range)

This method is compatible with:

  • Fast ball
  • Slow ball
  • Yorker
  • Spin

This was an implementation of a fast ball. It will also tell if it was a:

  • Good Delivery
  • Bad Delivery

Overall

from cricket.balling.overall_bowl_detection import CricketBallAnalyzer
import cricket.utils as utils

ball_colour_range = utils.color_ranges["white"]
analyser = CricketBallAnalyzer("video_path", ball_colour_range[0], ball_colour_range[1], 22)
decision = analyser.analyze_video()

This classifier class is compatible with:

  • Fast Ball
  • Slow ball
  • Yorker
  • Spin

Combined

from cricket.combined import classify_overall
import cricket.utils as utils

ball_colour = utils.color_ranges["white"]
decision = classify_overall("video_path", ball_colour, 22)

This will run both the classes given above and will return a dictionary. First key will be of bowling and second key will be of batting

Note: For ease of use you can import like this and it would import all things for implementation from both the subpackages

from cricket import *

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cricket_tannmay_headless-0.1.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cricket_tannmay_headless-0.1.1-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file cricket_tannmay_headless-0.1.1.tar.gz.

File metadata

  • Download URL: cricket_tannmay_headless-0.1.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for cricket_tannmay_headless-0.1.1.tar.gz
Algorithm Hash digest
SHA256 63306dd461d5963a3b8b6c4be7d0c7a61d90b8d422130354c026bf493e424554
MD5 aef42f51d4d3bcfe4f17e71e6f1016b3
BLAKE2b-256 6336cefac52e82007976c7020ee1ca80c5731a3c807ff89d1802e43f640d2498

See more details on using hashes here.

File details

Details for the file cricket_tannmay_headless-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cricket_tannmay_headless-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 caa91982ebe2fa51e1b9ec04bbdcaf44668ad0a428800b9ca026ba672f1eabdc
MD5 8614f687fea0227ca38465d48b4c917d
BLAKE2b-256 3b7bdade12874208adf3e25943ff60e13f977a5cbd0c989055f79301c8897c3d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page