Monochrome grayscale image, get the intensity of a pixel

后端 未结 1 858
情深已故
情深已故 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)
提交回复
热议问题