I am trying to load an image in a mat and resize it with the below code
Mat temp1= new Mat();
int[] train_responses = null;
Mat temp2 = new Mat();
Mat temp3 = new Mat();
Mat train_samples = new Mat();
for (int ii = 0; ii < 10; ii++){
temp1 = Highgui.imread("/mnt/sdcard/images/train/" + ii + ".png");
Imgproc.resize(temp1, temp2, new Size(30,20));
}
but the code crashes with the following log
opencv error assertion failed (ssize.area() > 0) in void cv::resize....
Where am I wrong?
Check that all your png images 0.png, 1.png, ... 9.png all exist, are in the correct location and have non-zero dimensions when you load them via imread. There's nothing otherwise wrong with the code - it works for me when I load my own png image using your code.
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.