Last active
August 6, 2018 12:25
-
-
Save Sren-Hmkn/be671caf870fd7b99aa6302d582c73e6 to your computer and use it in GitHub Desktop.
Adding function buttons, listeners and call OpenCvMaker methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//<ScrollView | |
//... | |
// <RelativeLayout | |
//... | |
//... | |
<Button | |
android:id="@+id/normal_mode" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_toRightOf="@id/cam_view" | |
android:text="make normal" | |
android:layout_margin="4dp"/> | |
<Button | |
android:id="@+id/canny_mode" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_below="@id/normal_mode" | |
android:layout_toRightOf="@id/cam_view" | |
android:text="make canny" | |
android:layout_margin="4dp"/> | |
<Button | |
android:id="@+id/gray_mode" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_below="@id/canny_mode" | |
android:layout_toRightOf="@id/cam_view" | |
android:text="make gray" | |
android:layout_margin="4dp"/> | |
<Button | |
android:id="@+id/dilate_mode" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_below="@id/gray_mode" | |
android:layout_toRightOf="@id/cam_view" | |
android:text="make dilate" | |
android:layout_margin="4dp"/> | |
<Button | |
android:id="@+id/erose_mode" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_below="@id/dilate_mode" | |
android:layout_toRightOf="@id/cam_view" | |
android:text="make erose" | |
android:layout_margin="4dp"/> | |
//... | |
// </RelativeLayout> | |
// </ScrollView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
// JavaCameraView javaCameraView; | |
// Mat usedMat; | |
Button makeNormal, makeGray, makeCanny, makeDilate, makeErode; | |
//... | |
// BaseLoaderCallback mLoaderCallBack = new BaseLoaderCallback(this){} | |
//... | |
// | |
// | |
// @Override | |
// protected void onCreate(Bundle savedInstanceState) { | |
// super.onCreate(savedInstanceState); | |
// setContentView(R.layout.activity_camera); | |
// | |
// javaCameraView = findViewById(R.id.cam_view); | |
// javaCameraView.setVisibility(SurfaceView.VISIBLE); | |
// javaCameraView.setCvCameraViewListener(this); | |
makeNormal = (Button) findViewById(R.id.normal_mode); | |
makeGray = (Button) findViewById(R.id.gray_mode); | |
makeRead = (Button) findViewById(R.id.read_button); | |
makeCanny = (Button) findViewById(R.id.canny_mode); | |
makeDilate = (Button) findViewById(R.id.dilate_mode); | |
makeErode = (Button) findViewById(R.id.erose_mode); | |
makeNormal.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
OpenCvMaker.setNormal(); | |
} | |
}); | |
makeGray.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
OpenCvMaker.toggleGray(); | |
} | |
}); | |
makeDilate.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
OpenCvMaker.toggleDilate(); | |
} | |
}); | |
makeErode.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
OpenCvMaker.toggleErode(); | |
} | |
}); | |
makeCanny.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
OpenCvMaker.toggleCanny(); | |
} | |
}); | |
// } | |
//... | |
//... | |
//... | |
// @Override | |
// public Mat onCameraFrame(Mat inputFrame) { | |
// usedMat = inputFrame; | |
OpenCvMaker.doStuffWithPic(inputFrame.getNativeObjAddr(), usedMat.getNativeObjAddr()); | |
// return usedMat; | |
// } | |
//} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment