0
A
回答
2
这可能不是您正在寻找的内容,但实际上编写图像操作和分析代码可以非常有用。这是用Java编写的:
//Image percentage match
public float getPercentMatch(String imageFile1, String imageFile2) {
//Set how close a pixel has to be for a match, pixel deviation
int pd = 3;
try {
//get height, width and image from first file
File input1 = new File(imageFile1);
image1 = ImageIO.read(input1);
width1 = image1.getWidth();
height1 = image1.getHeight();
//Do the same for the second one
File input2 = new File(imageFile2);
image2 = ImageIO.read(input2);
width2 = image2.getWidth();
height2 = image2.getHeight();
int matchCount = 0;
//Make sure they're the same height. You could also choose to use the
//smaller picture for dimensions
if (height1 != height2 || width1 != width2) {return 0.0;}
//Iterate over each pixel
for(int i=0; i<height1; i++){
for(int j=0; j<width1; j++){
//Get RGB values for each image at certain pixel
Color c1 = new Color(image1.getRGB(j, i));
Color c2 = new Color(image2.getRGB(j, i));
// If the colors are close enough based on deviation value...
if ( (Math.abs(c1.getRed() - c2.getRed()) < pd) &&
(Math.abs(c1.getGreen() - c2.getGreen()) < pd) &&
(Math.abs(c1.getBlue() - c2.getBlue()) < pd)) {
//...it's a match, so increment the match count
matchCount++;
}
}
}
return matchCount/(height1 * width1);
} catch (Exception e) {}
}
相关问题
- 1. 比较两幅图像
- 2. 比较PHP中的两幅图像
- 3. 直观地比较两幅图像
- 4. 比较两幅图像特定区域的直方图? OpenCV
- 5. 比较2幅图像的焦点
- 6. OSX:比较两个图像
- 7. 比较两个图像android
- 8. MATLAB - 两幅图像
- 9. 比较两幅图像中的文字,但不考虑颜色
- 10. 比较两幅图像的Daisy描述符
- 11. 如何比较两幅图像的质量?
- 12. 规模两幅图像比例jQuery中
- 13. 比较在C#中使用Emgu两幅指纹图像
- 14. 使用matlab对两幅图像进行颜色比较
- 15. 在Windows下Monkeyrunner中比较两幅图像
- 16. 与Imagick比较两幅图像后删除背景
- 17. 基于像素比较的2幅图像之间的差异
- 18. 比较图像
- 19. 图像比较
- 20. 比较两个图像图标?
- 21. 在Opencv C++中实时比较两幅图像与预定义图像的实时捕捉图像
- 22. 逐像素比较图像
- 23. 比较GIF图像像素
- 24. 比较Android中的两个图像
- 25. 比较图像的两个坐标值
- 26. 比较低质量的两个图像
- 27. 比较IOS中的两个图像8
- 28. SIFT-图像比较
- 29. 比较图像matlab
- 30. AForge图像比较
你正在使用Java还是使用JavaScript? – Timo
我有两个范围,我可以选择处理它在客户端即Java脚本或服务器端在Java中。 – sunder
[这个图书馆做你所问:https://huddle.github.io/Resemble.js/](https://huddle.github.io/Resemble.js/) –