简体   繁体   中英

Cannot retrieve file in assets folder in Android

I can't seem to get this line of code to find this file.

Mat topLeftMat = Highgui.imread("newTopLeftMarker.jpg");

I've been using this block of code to test to see if it's finding the file. I've tried a bunch of things but none of them have been working.

File imgFile = new File("newTopLeftMarker.jpg");
if(imgFile.exists())
{ 
Log.i(TAG, "YES");
} else {
Log.i(TAG, "NO");
}

Could someone point me in the right direction?

要从资产中检索文档,您必须执行以下操作:

final InputStream inputStream = getAssets().open("newTopLeftMarker.jpg");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM