July 2017
Beginner to intermediate
715 pages
17h 3m
English
Sometimes it is desirable to resize an image. The resize method shown next illustrates how this is done. The image is read in and a new Mat object is created. The resize method is then applied where the width and height are specified in the Size object parameter. The resized image is then saved:
Mat source = Imgcodecs.imread("cat.jpg"); Mat resizeimage = new Mat(); Imgproc.resize(source, resizeimage, new Size(250, 250)); Imgcodecs.imwrite("resizedCat.jpg", resizeimage);
The enhanced image follows:
