[英]Crop image ala Google Goggles
I'm trying to do some ROI (region of interest) selection in my app, but I don´t know, how to create some kind of resizable (by fingers) rectangle like you can see in Google Goggles. 我正在尝试在我的应用中做一些ROI(感兴趣区域)选择,但我不知道,如何创建某种可调整大小(通过手指)矩形,就像你在Google Goggles中看到的那样。 Can you help me?
你能帮助我吗? Is there any source code example?
有没有源代码示例?
My final solution is to draw and rectangle in the midle of a view and implement onTouchEvent() in my activity to set new corners coordinates like this: 我的最终解决方案是在视图的中间绘制和矩形,并在我的活动中实现onTouchEvent()以设置新的角坐标,如下所示:
@Override
public boolean onTouchEvent(MotionEvent me) {
if(SETTING_ROI == true){
if (me.getAction() == MotionEvent.ACTION_DOWN) {
START_DRAGGING = true;
myView.selectCorner((int) me.getRawX(), (int) me.getRawY()); // selecst nearest corner
}
if (me.getAction() == MotionEvent.ACTION_MOVE){
Log.d(TAG, "ACTION_MOVE");
myView.moveCorner((int) me.getRawX(), (int) me.getRawY()); // move selected corner continuously
}
if (me.getAction() == MotionEvent.ACTION_UP){
if (START_DRAGGING == true) {
START_DRAGGING = false;
myView.moveCorner((int) me.getRawX(), (int) me.getRawY()); // final selected corner move
}
}
}
return false;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.