ALA谷歌护目镜裁剪图像护目镜、图像、ALA

2023-09-06 13:42:19 作者:抱着猫睡觉

我试图做一些ROI(感兴趣区域)选择在我的应用程序,但我不知道,如何创造某种调整大小(用手指)的矩形状,你可以在谷歌护目镜看。 你能帮助我吗?是否有任何来源$ C ​​$ C的例子吗?

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 resizeable (by fingers) rectangle like you can see in Google Goggles. Can you help me? Is there any source code example?

感谢您

推荐答案

我最后的解决办法是在我的活动,以树立新的角落绘制和矩形在视图中的midle和实施的onTouchEvent()坐标如下:

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:

@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;
}