0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Desktop : OpenCV Mosaic

Posted at
Goal
Make a mosaic image with OpenCV.
OpenCV_Mosaic.java
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

import java.util.ArrayList;
import java.util.List;

public class OpenCV_Mosaic {

    public static void main(String[] args){
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

        Mat im  = Imgcodecs.imread("D:\\projects\\Java\\OpenCV_Samples\\resource\\imgs\\clean.jpg");

        Imgproc.resize(im,im,new Size(),0.1,0.1,Imgproc.INTER_NEAREST);
        Imgproc.resize(im,im,new Size(),10.0,10.0,Imgproc.INTER_NEAREST);
        Imgcodecs.imwrite("D:\\projects\\Java\\OpenCV_Samples\\resource\\imgs\\clean_mosaic.jpg", im);
    }
}
Result
![clean_mosaic.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/276243/f7e27ac2-93a6-a691-b802-abb337220c64.jpeg)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?