jacinle.image package

Submodules

jacinle.image.backend module

jacinle.image.backend.imread(path)[source]
jacinle.image.backend.imshow(title, image)[source]
jacinle.image.backend.imwrite(path, image)[source]
jacinle.image.backend.opencv_only(func)[source]
jacinle.image.backend.opencv_or_pil(func)[source]
jacinle.image.backend.pil_img2nd(image, require_chl3=True)[source]
jacinle.image.backend.pil_nd2img(image)[source]
jacinle.image.backend.pil_only(func)[source]
jacinle.image.backend.resize(image, dsize, interpolation='LINEAR')[source]

jacinle.image.codecs module

jacinle.image.codecs.jpeg_encode(img, quality=90)[source]

Encode the image with JPEG encoder.

Parameters:
  • img (numpy.ndarray) – uint8 color image array
  • quality (int) – quality for JPEG compression

Returns bytes: encoded image data

jacinle.image.codecs.png_encode(input, compress_level=3)[source]

Encode the image with PNG encoder.

Parameters:
  • img (numpy.ndarray) – uint8 color image array
  • quality (int) – quality for JPEG compression

Returns bytes: encoded image data

jacinle.image.codecs.imdecode(data, *, require_chl3=True, require_alpha=False)[source]

Decode images in common formats (jpg, png, etc.).

Parameters:
  • data (bytes) – encoded image data
  • require_chl3 – whether to convert gray image to 3-channel BGR image
  • require_alpha – whether to add alpha channel to BGR image

Returns: uint8 color image array

jacinle.image.imgio module

jacinle.image.imgio.imread(path, *, shuffle=False)[source]
jacinle.image.imgio.imwrite(path, img, *, shuffle=False)[source]
jacinle.image.imgio.imshow(title, img, *, shuffle=False)[source]

jacinle.image.imgproc module

jacinle.image.imgproc.resize(img, size, interpolation='LINEAR')[source]
jacinle.image.imgproc.resize_wh(img, size_wh, interpolation='LINEAR')[source]
jacinle.image.imgproc.resize_scale(img, scale, interpolation='LINEAR')[source]
jacinle.image.imgproc.resize_scale_wh(img, scale_wh, interpolation='LINEAR')[source]
jacinle.image.imgproc.resize_minmax(img, min_dim, max_dim=None, interpolation='LINEAR')[source]
jacinle.image.imgproc.crop(image, l, t, w, h, extra_crop=None)[source]
jacinle.image.imgproc.center_crop(img, target_shape)[source]

center crop

jacinle.image.imgproc.leftup_crop(img, target_shape)[source]

left-up crop

jacinle.image.imgproc.dimshuffle(img, shuffle_type)[source]
jacinle.image.imgproc.clip(img)[source]
jacinle.image.imgproc.clip_decorator(func)[source]
jacinle.image.imgproc.grayscale(img)[source]
jacinle.image.imgproc.brightness(img, alpha)[source]
jacinle.image.imgproc.contrast(img, alpha)[source]
jacinle.image.imgproc.saturation(img, alpha)[source]