Ask Your Question

Baccata's profile - activity

2018-10-29 10:16:09 -0600 received badge  Famous Question (source)
2016-05-30 23:16:02 -0600 received badge  Notable Question (source)
2015-11-17 10:51:18 -0600 received badge  Popular Question (source)
2014-08-16 11:51:43 -0600 received badge  Student (source)
2014-04-17 04:08:55 -0600 commented answer Java API : loading image from any Java InputStream

Okay here's what to do (in Scala. It's the same in Java) (cannot answer my own question cause I'm a newbie on this forum)

val inputStream : InputStream = ... val buf : Array[Byte] = ... //dump the content of the stream in this array val matBuf = new MatOfByte() matBuf.fromArray(buf: _*) //trick to use a scala array as a java varargs val mat = Highgui.imdecode(matBuf, Highgui.CV_LOAD_IMAGE_UNCHANGED) //tadaaaaaaaa

2014-04-16 11:57:12 -0600 asked a question Java API : loading image from any Java InputStream

Hello,

is there a way, using the Java bindings to OpenCV, to load an image from an InputStream, knowing only the format of the image (tiff, in my example). I'd like to load images from the Web or from other potential sources (hdfs) ?

Thank you