Skip to main content

A package to detect colored ArUco markers.

Project description

Color ArUco

Color ArUco is a Python package designed for detecting colored ArUco markers using OpenCV. This package includes functionality for capturing video from a webcam, detecting markers in real-time, and generating ArUco markers for various applications. Its primary purpose is to significantly increase the amount of data that can be transmitted via an ArUco marker. With the ability to encode over 1 trillion bits of data, it can transmit nearly a billion times more information compared to a standard ArUco marker.

Features

  • Detect colored ArUco markers in real-time from webcam footage.
  • Draw bounding boxes around detected markers with their IDs.
  • Generate ArUco markers with customizable parameters.

Installation

To install the package via pip, you can use the following command:

pip install color_aruco

Requirements

This package depends on the following libraries:

  • numpy
  • opencv-python

Usage

Detecting Markers

To use the marker detector with your webcam, you can run the following code:

import cv2
from color_aruco.aruco_marker_generator import MarkerDetector

def main():
    # Initialize marker detector
    detector = MarkerDetector()

    # Capture video from the webcam
    cap = cv2.VideoCapture(0)

    while True:
        ret, frame = cap.read()
        if not ret:
            break

        # Pass the frame to the marker detector
        markers = detector.detect_marker(frame)

        # Iterate over all detected markers and draw their bounding boxes and IDs
        for marker_id, bbox in markers:
            xmin, ymin, xmax, ymax = bbox
            cv2.rectangle(frame, (xmin, ymin), (xmax, ymax), (0, 255, 0), 2)
            cv2.putText(frame, f"ID: {marker_id}", (xmin, ymin - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2)

        # Show the frame
        cv2.imshow("frame", frame)

        # Exit if 'q' is pressed
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

    # Release the video capture and close windows
    cap.release()
    cv2.destroyAllWindows()

if __name__ == "__main__":
    main()

Generating ArUco Markers

You can also generate ArUco markers using the GenerateArucoMarker class:

from color_aruco.aruco_marker_generator import GenerateArucoMarker
import cv2

# Example usage:
if __name__ == "__main__":
    marker_id = 1099511627774  # Example marker ID
    pixel_size = 100  # Example pixel size for saving the image
    marker = GenerateArucoMarker(marker_id, pixel_size)
    cv2.imwrite('aruco_marker_0.png', marker.create_aruco())

Running Tests

To ensure everything is working correctly, you can run the unit tests provided in the tests folder:

python -m unittest discover tests

Contributing

Contributions are welcome! Please feel free to submit a pull request or create an issue if you encounter any bugs or have feature requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

color_aruco-0.0.3.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

color_aruco-0.0.3-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file color_aruco-0.0.3.tar.gz.

File metadata

  • Download URL: color_aruco-0.0.3.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for color_aruco-0.0.3.tar.gz
Algorithm Hash digest
SHA256 3d40718ac00cf0425bd405c8942cba99a63a7a42d874a75359fe5b2fc31ed24b
MD5 192a0eb3f40d2fafef4e40aea166c23e
BLAKE2b-256 1b96d05621a96ffe1bf0733735d198ed9a4c8c25d88a0a46be2ec6f22f387120

See more details on using hashes here.

File details

Details for the file color_aruco-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: color_aruco-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for color_aruco-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e8ee93905b64f9f8c1e23fd413c759f5d23281097cc0ce7330b5daa59c84001c
MD5 01451cb12aeadc40265d4fdc0c53d571
BLAKE2b-256 d2a2f3c9e084e29deef3cd0cbe2d1f1b08e3457b5bc325f30993fe1ba7a976bb

See more details on using hashes here.

Supported by

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