I am new to OpenCV in Android. I just wanted to make a samll test to the openCV lib in android. I downloaded an image .JPG and placed it inside the drawable folder, and I used the below code to read the image and display its size. when i run the below code i get the size of the image is 0x0 despite it is more than 400 kb.
why the size is 0x0 and how to get the right size?
code
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
Log.i("OpenCV", "OpenCV loaded successfully");
Mat image = readImageFromResources();
Log.i(TAG, "size: " + image.size());
Log.i(TAG, "rows: " + image.rows());
Log.i(TAG, "cols: " + image.cols());
break;
default:
super.onManagerConnected(status);
break;
}
}
private Mat readImageFromResources() {
return Imgcodecs.imread(getResources().getDrawable(R.drawable.see).toString());
}
};
}