0
A
回答
1
2
public int[] searchForColor(BufferedImage bi, int searchColor)
{
for (int x = 0; x < bi.getWidth(); ++x)
for (int y = 0; y < bi.getHeight(); ++y)
{
if ((bi.getRGB(x, y) & 0x00FFFFFF) == searchColor)
return new int[]{x, y};
}
}
用法:
BufferedImage bi = takeScreenShot();
int searchColor = 0x2D5E83; // A random color
int[] coordinate = searchForColor(bi, searchColor);
int x = coordinate[0];
int y = coordinate[1];
相關問題
- 1. 獲取X Y座標w.r.t圖像
- 2. 提取X,Y從圖像座標
- 3. 相處SVG路徑點的y座標給定的x座標
- 4. 如何從圖像中獲取像素的x,y座標顏色?
- 5. 獲取X和Y座標視圖
- 6. 如何獲取x,y座標
- 7. 從列表中獲取(x,y)座標
- 8. 從CvPoint獲取X Y座標
- 9. 在ImageView touch上獲取X/Y座標
- 10. 如何獲取網頁中元素的x,y座標?
- 11. 如何在Android中獲取(x,y)圖像的座標?
- 12. 從座標獲取像素
- 13. 在特定的x,y座標處獲取矩形的顏色
- 14. 圖像比較,無法抓住像素的x和y座標
- 15. 如何從圖像輸入中獲取x和y座標?
- 16. 爪哇SWT:獲取原始x/y座標從縮放圖像
- 17. 從圖像中獲取x和y座標
- 18. Java X Y座標
- 19. 圖像像素X,Y座標經緯度
- 20. 捕獲x,y與Python的座標PIL
- 21. 我怎樣才能實現像素顏色的x,y座標?
- 22. Three.js - 獲取鼠標點擊的X,Y和Z座標
- 23. Flex Datagrid - 如何獲取鼠標x/y座標的項目?
- 24. 在android中找到給定的x/y座標的視圖
- 25. 通過touchmove以20像素增量移動UIImage X座標或Y座標
- 26. 圍繞給定座標旋轉像素
- 27. 在javascript中創建簡單像素(x,y座標)塊字母
- 28. 獲取特定像素的x,y位置
- 29. 用鼠標點擊獲取X/Y座標
- 30. 將元素移動到指定的X,Y座標
你想第一像素的給定RGB的位置,如果我得到它的權利? –
checkt [this](http://stackoverflow.com/questions/1604319/getting-pixel-data-from-an-image-using-java)問題 – PTBG
這取決於你如何存儲圖像。例如,如果您將它作爲二維數組,您只需查看它就可以收集匹配的像素索引。 – zeller