以编程方式使用ImageJ查找边缘 [英] Find Edges with ImageJ Programmatically
本文介绍了以编程方式使用ImageJ查找边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用 ImageJ 的查找边缘选项,找到edge-found数组并以编程方式将其保存到另一个文件。
I want to use find edges option of the ImageJ, have the edges-found array and save it to another file programatically.
ImagePlus ip1 = IJ.openImage("myimage.jpg");
ImageProcessor ip = new ColorProcessor(ip1.getWidth(), ip1.getHeight());
ip.findEdges();
然而,函数 findEdges 是抽象的,我不能拥有边缘找到的图像。
However, the function findEdges is abstract and I can't have the edge-found image.
编辑:
我写了以下几行:
ip.findEdges();
BufferedImage bimg = ip.getBufferedImage();
然而,当我尝试打印出BufferedImage的RGB值时,它只打印-16777216 对于每个像素RGB。
However, when I try to print out the RGB values of the BufferedImage, it only prints "-16777216" for each pixel RGB.
推荐答案
好的,我得到了解决方案,问题是我没有连接ColorProcessor与图像。
OK, I got the solution, the problem was that I didn't connect the ColorProcessor with the image.
ColorProcessor ip = new ColorProcessor(ImageIO.read(new File("my_image.jpg")));
ip.findEdges();
BufferedImage bimg = ip.getBufferedImage();
这篇关于以编程方式使用ImageJ查找边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文