[英]Android, Eclipse, ADT : Validate GestureOverlayView
有没有一种方法可以检查从GestureOverlayView捕获的图像是否为空白,是否有图形?
I was having the same issue but in c#. 我在C#中遇到了同样的问题。 Blank image would mean "one color" let's say "black".
空白图像表示“一种颜色”,比方说“黑色”。 So, the only way to do this is comparing pixels together: if all pixels' colors are the same, it means the image is blank otherwise it isn't blank!
因此,唯一的方法就是将像素进行比较:如果所有像素的颜色都相同,则表示图像为空白,否则为非空白! You can use:**
您可以使用:**
getPixel()
If you have an idea about the blank image's color, you can build a similar method to this one : 如果您对空白图像的颜色有所了解,可以构建与此类似的方法:
for( int x=0; x< image.getWidth(); x++){
for( int y = 0; y< image.getHeight() ;y++){
if(pixel == Color.BLACK){
ourBoolVal=false;
break;
}else{
ourBoolVal=true;
}
}
}
return ourBoolVal;
Here is a good example for searching for through an image: Here 这是一个通过图像搜索的好例子: 这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.