parent
75813a7739
commit
8db1ea7b3e
@ -0,0 +1,25 @@
|
|||||||
|
package base;
|
||||||
|
|
||||||
|
import org.opencv.core.Mat;
|
||||||
|
import org.opencv.imgcodecs.Imgcodecs;
|
||||||
|
import org.opencv.imgproc.Imgproc;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片转为灰色
|
||||||
|
*/
|
||||||
|
public class ImageGray extends DllLoad {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
File file = new File("imgs/3.png");
|
||||||
|
Mat src = Imgcodecs.imread(file.getAbsolutePath());
|
||||||
|
|
||||||
|
Mat dst = new Mat();
|
||||||
|
//图片灰度化 https://blog.csdn.net/ren365880/article/details/103869207
|
||||||
|
Imgproc.cvtColor(src, dst, Imgproc.COLOR_BGR2GRAY);
|
||||||
|
|
||||||
|
show(dst);
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue