This is a secondary package of OpenCV,for manage image data
Project description
base_image
对opencv_python常用接口的二次开发
兼容了cuda与numpy两种格式的图像数据
Example
- Create
Create an object from test.png
import cv2
from baseImage import Image
Image(img='test.png', flags=cv2.IMREAD_COLOR, path='./')
# param img: can be fileName/bytes/numpy.ndarry/cuda_GpuMat
# param flags: 'https://docs.opencv.org/master/d8/d6a/group__imgcodecs__flags.html#ga61d9b0126a3e57d9277ac48327799c80'
# param path: Used to set the read path
- transform_gpu
Transform image Data to cuda_GpuMat
from baseImage import Image
img = Image('test.png')
img.transform_gpu()
- transform_cpu
Transform image Data to numpy.ndarray
from baseImage import Image
img = Image('test.png')
img.transform_cpu()
- imread
This returns image Data with numpy.ndarry
This function will call transform_cpu
from baseImage import Image
img = Image('test.png')
img.imread()
- download
This returns image Data with cuda_GpuMat
This function will call transform_gpu
from baseImage import Image
img = Image('test.png')
img.download()
- imwrite
Write Data to object
import cv2
from baseImage import Image
img = Image(path='./')
img.imwrite(img='test.png', flags=cv2.IMREAD_COLOR)
# param img: can be fileName/bytes/numpy.ndarry/cuda_GpuMat
# param flags: 'https://docs.opencv.org/master/d8/d6a/group__imgcodecs__flags.html#ga61d9b0126a3e57d9277ac48327799c80'
# param path: Used to set the read path
- shape
This returns image shape with tuple
from baseImage import Image
img = Image('test.png')
print(img.shape)
# Output example:(1080, 1920, 4)
- size
This return image size with tuple
from baseImage import Image
img = Image('test.png')
print(img.size)
# Output example:(1080, 1920)
- clone
Returns a new clone object
from baseImage import Image
img1 = Image('test.png')
print(img1)
img2 = img1.clone()
print(img2)
print(img1 == img2)
# Output example:False
More
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
baseImage-1.1.1.tar.gz
(13.6 kB
view hashes)