lanking520 commented on a change in pull request #13807: [MXNET-1180] Java 
Image API
URL: https://github.com/apache/incubator-mxnet/pull/13807#discussion_r248852482
 
 

 ##########
 File path: 
scala-package/core/src/main/scala/org/apache/mxnet/javaapi/Image.scala
 ##########
 @@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mxnet.javaapi
+// scalastyle:off
+import java.awt.image.BufferedImage
+// scalastyle:on
+import java.io.InputStream
+
+object Image {
+  /**
+    * Decode image with OpenCV.
+    * Note: return image in RGB by default, instead of OpenCV's default BGR.
+    * @param buf    Buffer containing binary encoded image
+    * @param flag   Convert decoded image to grayscale (0) or color (1).
+    * @param toRGB Whether to convert decoded image
+    *               to mxnet's default RGB format (instead of opencv's default 
BGR).
+    * @return NDArray in HWC format with DType [[DType.UInt8]]
+    */
+  def imDecode(buf: Array[Byte], flag: Int, toRGB: Boolean): NDArray = {
+    org.apache.mxnet.Image.imDecode(buf, flag, toRGB, None)
+  }
+
+  /**
+    * Same imageDecode with InputStream
+    * @param inputStream the inputStream of the image
+    * @return NDArray in HWC format with DType [[DType.UInt8]]
+    */
+  def imDecode(inputStream: InputStream, flag: Int = 1, toRGB: Boolean = 
true): NDArray = {
 
 Review comment:
   We can still expose this to users but essentially didn't find any help...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to