Monochrome grayscale image, get the intensity of a pixel

后端 未结 1 860
情深已故
情深已故 2021-01-24 15:00

I\'m attempting to derive an intensity value for a particular pixel in a monochrome \"grayscale\" image. I have some pseudocode, but thus far I\'ve been unable to implement some

1条回答
  •  时光取名叫无心
    2021-01-24 15:42

    Maybe this will help you:

    http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html

    http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html

    BufferedImage img = ImageIO.read(new File("filePath.png"));
    
    int sRbgColor = img.getRGB(int x, int y);
    
    Color c = new Color(sRbgColor);
    int red = c.getRed();
    int green = c.getGreen();
    int blue = c.getBlue();
    

    If it's monochrome, then red green and blue should be equal.

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题