blob: cc30c0040ec20d8b3c473a07d091359cf29536c3 [file] [log] [blame]
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>org.apache.clojure-mxnet.image documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Clojure-mxnet</span> <span class="project-version">1.8.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>org</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>apache</span></div></div></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>clojure-mxnet</span></div></div></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.base.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>base</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.callback.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>callback</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.context.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>context</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.dtype.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>dtype</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.eval-metric.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>eval-metric</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.executor.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>executor</span></div></a></li><li class="depth-4 branch current"><a href="org.apache.clojure-mxnet.image.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>image</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.infer.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>infer</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.initializer.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>initializer</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.io.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>io</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.kvstore.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>kvstore</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.kvstore-server.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>kvstore-server</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.layout.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>layout</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.lr-scheduler.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>lr-scheduler</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.module.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>module</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.monitor.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>monitor</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.ndarray.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ndarray</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.ndarray-api.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ndarray-api</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.ndarray-random-api.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ndarray-random-api</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.optimizer.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>optimizer</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.primitives.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>primitives</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.profiler.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>profiler</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.random.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>random</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.resource-scope.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>resource-scope</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.shape.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>shape</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.symbol.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>symbol</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.symbol-api.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>symbol-api</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.symbol-random-api.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>symbol-random-api</span></div></a></li><li class="depth-4 branch"><a href="org.apache.clojure-mxnet.util.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>util</span></div></a></li><li class="depth-4"><a href="org.apache.clojure-mxnet.visualization.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>visualization</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-apply-border"><div class="inner"><span>apply-border</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-COLOR"><div class="inner"><span>COLOR</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-decode"><div class="inner"><span>decode</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-decode-image"><div class="inner"><span>decode-image</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-draw-bounding-box.21"><div class="inner"><span>draw-bounding-box!</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-fixed-crop"><div class="inner"><span>fixed-crop</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-GRAYSCALE"><div class="inner"><span>GRAYSCALE</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-ndarray-.3Eimage"><div class="inner"><span>ndarray-&gt;image</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-read"><div class="inner"><span>read</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-read-image"><div class="inner"><span>read-image</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-resize"><div class="inner"><span>resize</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-resize-image"><div class="inner"><span>resize-image</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-rgb-array.3F"><div class="inner"><span>rgb-array?</span></div></a></li><li class="depth-1"><a href="org.apache.clojure-mxnet.image.html#var-to-image"><div class="inner"><span>to-image</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">org.apache.clojure-mxnet.image</h1><div class="doc"><pre class="plaintext">Image API of Clojure package.
</pre></div><div class="public anchor" id="var-apply-border"><h3>apply-border</h3><div class="usage"><code>(apply-border input top bottom left right {:keys [fill-type value values output], :or {fill-type nil, value nil, values nil, output nil}, :as opts})</code><code>(apply-border input top bottom left right)</code></div><div class="doc"><pre class="plaintext">Pad image border with OpenCV.
`input`: `NDArray` - source image in NDArray
`top`: int - Top margin
`bottom`: int - Bottom margin
`left`: int - Left margin
`right`: int - Right margin
`fill-type`: nil or Filling type - Default BORDER_CONSTANT
`value`: nil or double - Deprecated, use `values` instead
`values`: Fill with value(RGB or gray), up to 4 channels
`output`: nil or `NDArray`
returns: `NDArray`
Ex:
(apply-border img-nd 1 1 1 1)
(apply-border img-nd 3 3 0 0)</pre></div></div><div class="public anchor" id="var-COLOR"><h3>COLOR</h3><div class="usage"></div><div class="doc"><pre class="plaintext"></pre></div></div><div class="public anchor" id="var-decode"><h3>decode</h3><div class="usage"><code>(decode input-stream {:keys [color to-rgb output], :or {color :color, to-rgb true, output nil}, :as opts})</code><code>(decode input-stream)</code></div><div class="doc"><pre class="plaintext">Decodes an image from an input stream with OpenCV.
`input-stream`: `InputStream` - Contains the binary encoded image
`color`: keyword in `#{:color :grayscale}` - Convert decoded image to
grayscale or color
`to-rgb`: boolean - Whether to convert decoded image to mxnet's default RGB
format (instead of opencv's default BGR)
`output`: nil or `NDArray`
returns: `NDArray` with dtype uint8
Ex:
(decode input-stream)
(decode input-stream {:color :color})
(decode input-stream {:color :grayscale :output nd})</pre></div></div><div class="public anchor" id="var-decode-image"><h3>decode-image</h3><h4 class="deprecated">deprecated</h4><div class="usage"><code>(decode-image input-stream {:keys [color-flag to-rgb output], :or {color-flag COLOR, to-rgb true, output nil}, :as opts})</code><code>(decode-image input-stream)</code></div><div class="doc"><pre class="plaintext">DEPRECATED: use `decode` instead.
Decodes an image from an input stream with OpenCV
`input-stream`: `InputStream` - Contains the binary encoded image
`color-flag`: 0 or 1 - Convert decoded image to grayscale (0) or color (1)
`to-rgb`: boolean - Whether to convert decoded image to mxnet's default RGB
format (instead of opencv's default BGR)
`output`: nil or `NDArray`
returns: `NDArray` with dtype uint8
Ex:
(decode-image input-stream)
(decode-image input-stream {:color-flag 1})
(decode-image input-stream {:color-flag 0 :output nd})</pre></div></div><div class="public anchor" id="var-draw-bounding-box.21"><h3>draw-bounding-box!</h3><div class="usage"><code>(draw-bounding-box! buffered-image coordinates)</code><code>(draw-bounding-box! buffered-image coordinates {:keys [names stroke font-size-mult transparency], :or {stroke 3, font-size-mult 1.0, transparency 1.0}, :as opts})</code></div><div class="doc"><pre class="plaintext">Draw bounding boxes on `buffered-image` and Mutate the input image.
`buffered-image`: BufferedImage
`coordinates`: collection of {:xmin int :xmax int :ymin int :ymax int}
`font-size-mult`: positive float - Font size multiplier
`names`: collection of strings - List of names for the bounding boxes
`stroke`: positive integer - thickness of the bounding box
`transparency`: float in (0.0, 1.0) - Transparency of the bounding box
returns: Modified `buffered-image`
Ex:
(draw-bounding-box! img [{:x-min 0 :x-max 100 :y-min 0 :y-max 100}])
(draw-bounding-box! [{:x-min 190 :x-max 850 :y-min 50 :y-max 450}
{:x-min 200 :x-max 350 :y-min 440 :y-max 530}]
{:stroke 2
:names ["pug" "cookie"]
:transparency 0.8
:font-size-mult 2.0})</pre></div></div><div class="public anchor" id="var-fixed-crop"><h3>fixed-crop</h3><div class="usage"><code>(fixed-crop input x0 y0 w h)</code></div><div class="doc"><pre class="plaintext">Return a fixed crop of the image.
`input`: `NDArray` - Source image in NDArray
`x0`: int - Starting x point
`y0`: int - Starting y point
`w`: int - Width of the image
`h`: int - Height of the image
returns: cropped `NDArray`
Ex:
(fixed-crop nd-img 0 0 28 28)
(fixed-crop nd-img 10 0 100 300)</pre></div></div><div class="public anchor" id="var-GRAYSCALE"><h3>GRAYSCALE</h3><div class="usage"></div><div class="doc"><pre class="plaintext"></pre></div></div><div class="public anchor" id="var-ndarray-.3Eimage"><h3>ndarray-&gt;image</h3><div class="usage"><code>(ndarray-&gt;image input)</code></div><div class="doc"><pre class="plaintext">Convert a NDArray image in RGB format to a real image.
`input`: `NDArray` - Source image in NDArray
returns: `BufferedImage`</pre></div></div><div class="public anchor" id="var-read"><h3>read</h3><div class="usage"><code>(read filename {:keys [color to-rgb output], :or {color :color, to-rgb nil, output nil}, :as opts})</code><code>(read filename)</code></div><div class="doc"><pre class="plaintext">Reads an image file and returns an ndarray with OpenCV. It returns image in
RGB by default instead of OpenCV's default BGR.
`filename`: string - Name of the image file to be loaded
`color`: keyword in `#{:color :grayscale}` - Convert decoded image to
grayscale or color
`to-rgb`: boolean - Whether to convert decoded image to mxnet's default RGB
format (instead of opencv's default BGR)
`output`: nil or `NDArray`
returns: `NDArray` with dtype uint8
Ex:
(read "cat.jpg")
(read "cat.jpg" {:color :grayscale})
(read "cat.jpg" {:color :color :output nd})</pre></div></div><div class="public anchor" id="var-read-image"><h3>read-image</h3><h4 class="deprecated">deprecated</h4><div class="usage"><code>(read-image filename {:keys [color-flag to-rgb output], :or {color-flag nil, to-rgb nil, output nil}, :as opts})</code><code>(read-image filename)</code></div><div class="doc"><pre class="plaintext">DEPRECATED: use `read` instead.
Reads an image file and returns an ndarray with OpenCV. It returns image in
RGB by default instead of OpenCV's default BGR.
`filename`: string - Name of the image file to be loaded
`color-flag`: 0 or 1 - Convert decoded image to grayscale (0) or color (1)
`to-rgb`: boolean - Whether to convert decoded image to mxnet's default RGB
format (instead of opencv's default BGR)
`output`: nil or `NDArray`
returns: `NDArray` with dtype uint8
Ex:
(read-image "cat.jpg")
(read-image "cat.jpg" {:color-flag 0})
(read-image "cat.jpg" {:color-flag 1 :output nd})</pre></div></div><div class="public anchor" id="var-resize"><h3>resize</h3><div class="usage"><code>(resize input w h {:keys [interpolation output], :or {interpolation nil, output nil}, :as opts})</code><code>(resize input w h)</code></div><div class="doc"><pre class="plaintext">Resizes the image array to (width, height)
`input`: `NDArray` - source image in NDArray
`w`: int - Width of resized image
`h`: int - Height of resized image
`interpolation`: Interpolation method. Default is INTER_LINEAR
`ouput`: nil or `NDArray`
returns: `NDArray`
Ex:
(resize nd-img 300 300)
(resize nd-img 28 28 {:output nd})</pre></div></div><div class="public anchor" id="var-resize-image"><h3>resize-image</h3><h4 class="deprecated">deprecated</h4><div class="usage"><code>(resize-image input w h {:keys [interpolation output], :or {interpolation nil, output nil}, :as opts})</code><code>(resize-image input w h)</code></div><div class="doc"><pre class="plaintext">DEPRECATED: use `resize` instead.
Resizes the image array to (width, height)
`input`: `NDArray` - source image in NDArray
`w`: int - Width of resized image
`h`: int - Height of resized image
`interpolation`: Interpolation method. Default is INTER_LINEAR
`ouput`: nil or `NDArray`
returns: `NDArray`
Ex:
(resize-image nd-img 300 300)
(resize-image nd-img 28 28 {:output nd})</pre></div></div><div class="public anchor" id="var-rgb-array.3F"><h3>rgb-array?</h3><div class="usage"><code>(rgb-array? input)</code></div><div class="doc"><pre class="plaintext">Returns whether the ndarray is in the RGB format
`input`: `NDArray` - Source image in NDArray
returns: boolean</pre></div></div><div class="public anchor" id="var-to-image"><h3>to-image</h3><h4 class="deprecated">deprecated</h4><div class="usage"><code>(to-image input)</code></div><div class="doc"><pre class="plaintext">DEPRECATED: user `ndarray-&gt;image` instead.
Convert a NDArray image in RGB format to a real image.
`input`: `NDArray` - Source image in NDArray
returns: `BufferedImage`</pre></div></div></div></body></html>