Skip to content

XDzzzzzZyq/computer-vision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CUDA Vision

Open-source Computer Vision Library implemented by CUDA. https://github.com/XDzzzzzZyq/computer-vision

Introduction

This is an open-source computer vision library developed in Python, utilizing the PyTorch framework and optimized with CUDA for accelerated processing on GPUs. Designed to be flexible and powerful, the library provides a range of advanced computer vision tools and algorithms, enabling high-performance image processing and deep learning applications. With CUDA integration, it harnesses the computational power of GPUs, making it suitable for handling large-scale datasets and real-time applications.

Image Format

This library treats images as tensors that strictly follows the shape (B,C,H,W). Where B is the batch size, C is the number of channels, H,W are the height and width of images correspondingly.

Two storage methods are supported, unsigned bytes ranging within [0,255] or standard float32.

CUDA Vision

All CUDA operators will be complied during run-time. Take grays-cale conversion as an example:

from cuda_vision.convert import to_grayscale
from cuda_vision.enhance import uniform_equalize
from cuda_vision.filters import bilateral_filter
from utils.imageIO import load_raw, compare_imgs

img = load_raw('imgs/building2_color.raw', 256, 256, 3)
gray1 = to_grayscale(img)
gray2 = uniform_equalize(gray1, 64)
gray3 = bilateral_filter(gray2, 10.0, 50.0, 20, 20)
compare_imgs([img, gray1, gray2, gray3])

The following functionalities are supported:

convert

  • Grayscale Conversion
  • Grayscale Inversion
  • Binarization
    • Thresholding
    • Random Thresholding
    • Dithering & Error Diffusion

combine

  • Making watermark
  • Float/Logic Arithmetics
  • Clamp

enhance

  • Min-Max Scaling
  • Histogram Equalization

filters

  • Convolution
  • Blurring
  • Pattern Matching
  • Morphology Operations: shrink, thin, skeletonize, ...

Utils

For imageIO and visualization, tools are provided in the utils.

Load Image

For .raw files, it should indicate the width, height, and channel of current image.

from utils.imageIO import load_raw
ori = load_raw('imgs/rose_color.raw',       256, 256, 3)
noi = load_raw('imgs/rose_color_noise.raw', 256, 256, 3)

Show Image & Histogram

from utils.imageIO import show_img, compare_imgs, show_hist, compare_hist
show_img(ori)
compare_imgs([ori, noi, denoised])
show_hist(ori)
compare_hist([ori, noi, denoised])
compare_hist([ori, noi, denoised], accu=True)

Required Environment

  • Matplotlib
  • Pytorch (CUDA)
  • A Nvidia Graphics Card

About

CS 207 Homeworks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published