怎么把Mat(opencv)转换成INDArray(DL4J)? [英] How to convert Mat (opencv) to INDArray (DL4J)?

查看:210
本文介绍了怎么把Mat(opencv)转换成INDArray(DL4J)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望任何人都可以帮助我解决此任务.我正在使用一些图像分类,并尝试将OpenCv 3.2.0和DL4J结合在一起.我知道DL4J也包含Opencv,但我认为它没有用.

I hope anyone can help me to fix this task. I'm working with some Image Classification and tried to combine OpenCv 3.2.0 and DL4J. I knew DL4J also included Opencv, but i think it's useless.

任何人都可以帮助我,如何将其转换为INDArray? 我尝试在此处阅读一些问题,并且DL4J的Class NativeImageLoader提供了该方法,asMatrix(垫子图像). 但是,当我尝试运行它时,出现了错误

Can anyone help me, how to convert into INDArray ? I tried to read some issue here and Class NativeImageLoader from DL4J has provide the method, asMatrix(Mat image). But when i tried to runing it i got an error

java:找不到适用于asMatrix(org.opencv.core.Mat)的合适方法

java: no suitable method found for asMatrix(org.opencv.core.Mat)

我不知道该如何解决我的代码,否则我的代码可能有问题.谁能帮助我找出问题所在?

I don't know how to fix it my code, or maybe there's something wrong with my code. Can anyone help me to find out the problem ?

顺便说一下,这是我的代码:

Btw here's my code :

Mat imgMat = Imgcodecs.imread("C:\\Pictures\\image.jpg");
INDArray image = loader.asMatrix(imgMat);

感谢您的关注.

推荐答案

您可以尝试org.datavec.image.loader.NativeImageLoader

public INDArray asMatrix(Mat image)引发IOException

这篇关于怎么把Mat(opencv)转换成INDArray(DL4J)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆