在Java中逐像素访问图像(Accessing Image pixel by pixel in Java)

编程入门 行业动态 更新时间:2024-10-28 18:24:38
在Java中逐像素访问图像(Accessing Image pixel by pixel in Java)

是否有任何内置的Java API或类库来访问给定图像中的像素? 我打算做的是在另一张图片中搜索一张图片。 例如:img1是24x24px,img2是1024x768px假设img2中可能存在类似于img1的符号。 现在我想获得与img1类似的符号的X和Y坐标。

Is there any inbuilt java API or class library for accessing pixels in a given image? What I am planning to do is search one image inside another image. For example : img1 is 24x24px , img2 is 1024x768px assume that a symbol, similar to img1 may exists in img2 . Now I want to get X and Y coordinates of the symbol which is similar to the img1.

最满意答案

是的,如果将图像作为BufferedImage则使用getRGB(int x, int y)方法获取位置(x,y)上像素的值。

请参阅java.awt.image.BufferedImage的API文档。

Yes, there is, if you have your image as a BufferedImage then use the getRGB(int x, int y) method to get the value of the pixel at the position (x, y).

See the API documentation of java.awt.image.BufferedImage.

更多推荐

img,API,电脑培训,计算机培训,IT培训"/> <meta name="description" con

本文发布于:2023-08-01 02:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1350486.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:像素   图像   Java   pixel   Image

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!