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

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-0.1.6.tar.gz (13.2 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-0.1.6-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file cricket_tannmay-0.1.6.tar.gz.

File metadata

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

File hashes

Hashes for cricket_tannmay-0.1.6.tar.gz
Algorithm Hash digest
SHA256 bcc89daabef7e0a7875e0643cfcbcc4fd7cdbd47950c49beb81aa84632bc14b1
MD5 f244b5effd784d6f6d6dcbab4800bd61
BLAKE2b-256 cf1ff98cf8ff90940ebb1f1cf8d6fda40b03a4ba84b68d79be9c6777166e7438

See more details on using hashes here.

File details

Details for the file cricket_tannmay-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for cricket_tannmay-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7a69df97971d420f098bf4d4531db23d15e0714bc51976940fd2193bf8aaf5e4
MD5 59cff9b8dcfc36cb7dffc0e9c510be56
BLAKE2b-256 5322d0950e5c614c9e9023f632c2e5a2bd05c604bcca94f406eeb983356eb70b

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