(buffered-image-has-alpha-channel? img)
Return true of this image has alpha channel
Return true of this image has alpha channel
(content-rect->gray-image src-img content-rect)
Without a specific method to get a precise content mask we can create one from the content rect returned from image->content-rect.
Without a specific method to get a precise content mask we can create one from the content rect returned from image->content-rect.
(generate-n-filtered-rects rect-filter-fn
content-rect
rect-count
rect-dim
&
{:keys [max-src-rect-count]
:or {max-src-rect-count 500}})
Generate max-src-rect-count random sub-rects, filter by a given filter function. Return rect-count of those.
Generate max-src-rect-count random sub-rects, filter by a given filter function. Return rect-count of those.
(image->patch img
&
{:keys [rect datatype colorspace data-array normalize]
:or {datatype :double colorspace :rgb normalize true}})
By default, turns BufferedImage img into an array suitable for cortex input. If :normalize set to false, returns RGB array of pixel values.
By default, turns BufferedImage img into an array suitable for cortex input. If :normalize set to false, returns RGB array of pixel values.
(image->patch-impl data-array num-pixels cast-fn array-fn normalize?)
(image->patches img
patches-per-image
patch-dim
datatype
&
{:keys [image-augmentation-fn]})
If an image has an alpha channel, then we assume it has a mask. Else we assume it is safe to create patches out of the entire image.
If an image has an alpha channel, then we assume it has a mask. Else we assume it is safe to create patches out of the entire image.
(image-src->patches img-src
patches-per-image
patch-dim
datatype
&
{:keys [image-augmentation-fn]})
Given a filename produce a set of random rgb patches of a given datatype potentially augmented.
Given a filename produce a set of random rgb patches of a given datatype potentially augmented.
(is-rect-completely-within-mask? mask-img rect)
(is-rect-completely-within-mask? mask-img rect byte-data)
Is this rect contained by the mask
Is this rect contained by the mask
(masked-image->patches img
mask-img
patch-count
patch-dim
content-rect
datatype
&
{:keys [image-augmentation-fn]})
(patch-mean-subtract patch r-mean g-mean b-mean & {:keys [bgr-reorder]})
Subtracts means of global images from each channel and optionally reorders RGB->BGR. Use for ResNet image preprocessing.
Subtracts means of global images from each channel and optionally reorders RGB->BGR. Use for ResNet image preprocessing.
(random-sub-rect outer-rect output-dim)
Create a square sub-rect inside the outer-rect
Create a square sub-rect inside the outer-rect
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close