rename packages

This commit is contained in:
Mautisim Munir 2022-11-10 03:44:57 +05:00
parent e857430326
commit 16a52fd95a
43 changed files with 88 additions and 88 deletions

View File

@ -30,7 +30,7 @@ android {
dependencies { dependencies {
implementation project(':copperlabs-lindera') implementation project(':copperlabs-computer-vision')
implementation project(':copperlabs-pose-api') implementation project(':copperlabs-pose-api')
implementation project(':copperlabs-pose-detection') implementation project(':copperlabs-pose-detection')
implementation project(':copperlabs-pose-landmark') implementation project(':copperlabs-pose-landmark')

View File

@ -22,7 +22,7 @@
android:theme="@style/Theme.Posetracking" android:theme="@style/Theme.Posetracking"
tools:targetApi="31"> tools:targetApi="31">
<activity <activity
android:name=".examples.posetracking_lindera.MainActivity" android:name="ca.copperlabs.mediapipe.examples.posetracking_lindera.MainActivity"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@ -1,20 +1,18 @@
package com.google.mediapipe.examples.posetracking_lindera; package ca.copperlabs.mediapipe.examples.posetracking_lindera;
import static java.lang.Math.min; import static java.lang.Math.min;
import com.google.mediapipe.solutions.lindera.BodyJoints; import ca.copperlabs.cv.BodyJoints;
import com.google.mediapipe.solutions.lindera.ComputerVisionPlugin; import ca.copperlabs.cv.ComputerVisionPlugin;
import com.google.mediapipe.solutions.lindera.XYZPointWithConfidence; import ca.copperlabs.cv.XYZPointWithConfidence;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
public class ComputerVisionPluginImpl implements ComputerVisionPlugin { public class ComputerVisionPluginImpl implements ComputerVisionPlugin {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.mediapipe.examples.posetracking_lindera; package ca.copperlabs.mediapipe.examples.posetracking_lindera;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.ContentValues; import android.content.ContentValues;
@ -33,9 +33,9 @@ import androidx.appcompat.app.AppCompatActivity;
import com.afollestad.materialdialogs.MaterialDialog; import com.afollestad.materialdialogs.MaterialDialog;
import com.google.mediapipe.R; import com.google.mediapipe.R;
import com.google.mediapipe.solutions.lindera.CameraRotation; import ca.copperlabs.cv.CameraRotation;
import com.google.mediapipe.solutions.lindera.InputSource; import ca.copperlabs.cv.InputSource;
import com.google.mediapipe.solutions.lindera.Lindera; import ca.copperlabs.cv.ComputerVision;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -56,7 +56,7 @@ import java.util.function.Consumer;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity"; private static final String TAG = "MainActivity";
private Lindera lindera; private ComputerVision computerVision;
private ComputerVisionPluginImpl plugin; private ComputerVisionPluginImpl plugin;
private boolean isLinderaInitialized = false; private boolean isLinderaInitialized = false;
private boolean isDetectionStarted = false; private boolean isDetectionStarted = false;
@ -78,13 +78,13 @@ public class MainActivity extends AppCompatActivity {
plugin = new ComputerVisionPluginImpl(); plugin = new ComputerVisionPluginImpl();
lindera = new Lindera(plugin); computerVision = new ComputerVision(plugin);
lindera.setupVideoPicker(this); computerVision.setupVideoPicker(this);
List<String> cameras = lindera.getAvailableCameras(); List<String> cameras = computerVision.getAvailableCameras();
// FRONT or BACK // FRONT or BACK
lindera.setCamera("BACK"); computerVision.setCamera("BACK");
lindera.setCameraRotation(CameraRotation.AUTOMATIC); computerVision.setCameraRotation(CameraRotation.AUTOMATIC);
lindera.fpsHelper.onFpsUpdate = new Consumer<Double>() { computerVision.fpsHelper.onFpsUpdate = new Consumer<Double>() {
@Override @Override
public void accept(Double fps) { public void accept(Double fps) {
String text = "FPS: "+String.format("%04.1f" ,fps); String text = "FPS: "+String.format("%04.1f" ,fps);
@ -102,9 +102,9 @@ public class MainActivity extends AppCompatActivity {
if (!isLinderaInitialized) { if (!isLinderaInitialized) {
modelLoadAsyncDialogue(()->{ modelLoadAsyncDialogue(()->{
if (inputSource==InputSource.VIDEO){ if (inputSource==InputSource.VIDEO){
lindera.setInputSource(InputSource.VIDEO); computerVision.setInputSource(InputSource.VIDEO);
} }
lindera.initialize(findViewById(R.id.preview_display_layout), MainActivity.this); computerVision.initialize(findViewById(R.id.preview_display_layout), MainActivity.this);
isLinderaInitialized = true; isLinderaInitialized = true;
findViewById(R.id.button_start_video).setVisibility(View.GONE); findViewById(R.id.button_start_video).setVisibility(View.GONE);
findViewById(R.id.button_start_camera).setVisibility(View.GONE); findViewById(R.id.button_start_camera).setVisibility(View.GONE);
@ -115,7 +115,7 @@ public class MainActivity extends AppCompatActivity {
updateLandmarkButtonText(); updateLandmarkButtonText();
updateModelComplexityButtonText(); updateModelComplexityButtonText();
if (inputSource==InputSource.VIDEO) { if (inputSource==InputSource.VIDEO) {
lindera.pickVideo(); computerVision.pickVideo();
} }
}); });
@ -153,7 +153,7 @@ public class MainActivity extends AppCompatActivity {
toggleLandmarks.setOnClickListener( toggleLandmarks.setOnClickListener(
v ->{ v ->{
this.lindera.setLandmarksVisibility(!this.lindera.getLandmarkVisibility()); this.computerVision.setLandmarksVisibility(!this.computerVision.getLandmarkVisibility());
updateLandmarkButtonText(); updateLandmarkButtonText();
} }
); );
@ -213,7 +213,7 @@ public class MainActivity extends AppCompatActivity {
}); });
modelComplexity.setOnClickListener(v->{ modelComplexity.setOnClickListener(v->{
int modelComplexityVal = lindera.getModelComplexity(); int modelComplexityVal = computerVision.getModelComplexity();
new MaterialDialog.Builder(this) new MaterialDialog.Builder(this)
.title("Choose Model Complexity") .title("Choose Model Complexity")
@ -227,8 +227,8 @@ public class MainActivity extends AppCompatActivity {
**/ **/
if (which != modelComplexityVal){ if (which != modelComplexityVal){
modelLoadAsyncDialogue(()-> { modelLoadAsyncDialogue(()-> {
lindera.setModelComplexity(which); computerVision.setModelComplexity(which);
lindera.restartDetection(); computerVision.restartDetection();
updateModelComplexityButtonText(); updateModelComplexityButtonText();
}); });
} }
@ -247,7 +247,7 @@ public class MainActivity extends AppCompatActivity {
void updateLandmarkButtonText(){ void updateLandmarkButtonText(){
Button toggleLandmarks = findViewById(R.id.button_toggle_landmarks); Button toggleLandmarks = findViewById(R.id.button_toggle_landmarks);
if (this.lindera.getLandmarkVisibility()) { if (this.computerVision.getLandmarkVisibility()) {
toggleLandmarks.setText("Show Landmarks (On)"); toggleLandmarks.setText("Show Landmarks (On)");
}else{ }else{
toggleLandmarks.setText("Show Landmarks (Off)"); toggleLandmarks.setText("Show Landmarks (Off)");
@ -257,7 +257,7 @@ public class MainActivity extends AppCompatActivity {
void updateModelComplexityButtonText(){ void updateModelComplexityButtonText(){
String text = "Select Model "; String text = "Select Model ";
switch (this.lindera.getModelComplexity()){ switch (this.computerVision.getModelComplexity()){
case 0: case 0:
text += "(lite)"; text += "(lite)";
break; break;

View File

@ -3,7 +3,7 @@ plugins {
} }
android { android {
namespace 'com.google.mediapipe.solutions.lindera' namespace 'ca.copperlabs.cv'
compileSdk 32 compileSdk 32
defaultConfig { defaultConfig {

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.mediapipe.solutions.posetracking"> package="ca.copperlabs.cv">
<uses-sdk android:minSdkVersion="21" <uses-sdk android:minSdkVersion="21"
android:targetSdkVersion="27" /> android:targetSdkVersion="27" />

View File

@ -1,4 +1,4 @@
package com.google.mediapipe.solutions.lindera; package ca.copperlabs.cv;
public class BodyJoints { public class BodyJoints {
public XYZPointWithConfidence neckNose; public XYZPointWithConfidence neckNose;

View File

@ -1,4 +1,4 @@
package com.google.mediapipe.solutions.lindera; package ca.copperlabs.cv;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
@ -16,16 +16,16 @@ import com.google.mediapipe.formats.proto.LandmarkProto;
import com.google.mediapipe.solutioncore.CameraInput; import com.google.mediapipe.solutioncore.CameraInput;
import com.google.mediapipe.solutioncore.SolutionGlSurfaceView; import com.google.mediapipe.solutioncore.SolutionGlSurfaceView;
import com.google.mediapipe.solutioncore.VideoInput; import com.google.mediapipe.solutioncore.VideoInput;
import com.google.mediapipe.solutions.posetracking.PoseTracking; import ca.copperlabs.mediapipe.posetracking.PoseTracking;
import com.google.mediapipe.solutions.posetracking.PoseTrackingOptions; import ca.copperlabs.mediapipe.posetracking.PoseTrackingOptions;
import com.google.mediapipe.solutions.posetracking.PoseTrackingResult; import ca.copperlabs.mediapipe.posetracking.PoseTrackingResult;
import com.google.mediapipe.solutions.posetracking.PoseTrackingResultGlRenderer; import ca.copperlabs.mediapipe.posetracking.PoseTrackingResultGlRenderer;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class Lindera { public class ComputerVision {
private ComputerVisionPlugin plugin; private ComputerVisionPlugin plugin;
public FpsHelper fpsHelper = new FpsHelper(); public FpsHelper fpsHelper = new FpsHelper();
@ -43,7 +43,7 @@ public class Lindera {
private VideoInput videoInput; private VideoInput videoInput;
private ActivityResultLauncher<Intent> videoGetter; private ActivityResultLauncher<Intent> videoGetter;
public Lindera(ComputerVisionPlugin plugin){ public ComputerVision(ComputerVisionPlugin plugin){
this.plugin = plugin; this.plugin = plugin;
} }

View File

@ -1,4 +1,4 @@
package com.google.mediapipe.solutions.lindera; package ca.copperlabs.cv;
public interface ComputerVisionPlugin { public interface ComputerVisionPlugin {
void bodyJoints(Long timestamp, BodyJoints bodyJoints); void bodyJoints(Long timestamp, BodyJoints bodyJoints);

View File

@ -0,0 +1,5 @@
package ca.copperlabs.cv;
public enum InputSource {
VIDEO, CAMERA
}

View File

@ -1,4 +1,4 @@
package com.google.mediapipe.solutions.lindera; package ca.copperlabs.cv;
public class XYZPointWithConfidence { public class XYZPointWithConfidence {
public float x = 0; public float x = 0;

View File

@ -1,5 +0,0 @@
package com.google.mediapipe.solutions.lindera;
public enum InputSource {
VIDEO, CAMERA
}

View File

@ -17,7 +17,7 @@ licenses(["notice"])
android_library( android_library(
name = "copperlabs-pose-api", name = "copperlabs-pose-api",
srcs = glob(["src/main/**/*.java"]), srcs = glob(["src/main/**/*.java"]),
custom_package = "com.google.mediapipe.solutions", custom_package = "ca.copperlabs.mediapipe.posetracking",
javacopts = ["-Acom.google.auto.value.AutoBuilderIsUnstable"], javacopts = ["-Acom.google.auto.value.AutoBuilderIsUnstable"],
manifest = "src/main/AndroidManifest.xml", manifest = "src/main/AndroidManifest.xml",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],

View File

@ -3,7 +3,7 @@ plugins {
} }
android { android {
namespace 'com.google.mediapipe.solutions.posetracking' namespace 'ca.copperlabs.mediapipe.posetracking'
compileSdk 32 compileSdk 32
defaultConfig { defaultConfig {

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.mediapipe.solutions"> package="ca.copperlabs.mediapipe.posetracking">
<uses-sdk android:minSdkVersion="24" <uses-sdk android:minSdkVersion="24"
android:targetSdkVersion="27" /> android:targetSdkVersion="27" />
</manifest> </manifest>

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.mediapipe.solutions.posetracking; package ca.copperlabs.mediapipe.posetracking;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.mediapipe.solutions.posetracking; package ca.copperlabs.mediapipe.posetracking;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;

View File

@ -12,10 +12,12 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.mediapipe.solutions.posetracking; package ca.copperlabs.mediapipe.posetracking;
import com.google.auto.value.AutoValue; import com.google.auto.value.AutoValue;
import ca.copperlabs.mediapipe.posetracking.AutoValue_PoseTrackingOptions;
/** /**
* MediaPipe Face Detection solution-specific options. * MediaPipe Face Detection solution-specific options.
* *

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.mediapipe.solutions.posetracking; package ca.copperlabs.mediapipe.posetracking;
import static java.lang.Math.min; import static java.lang.Math.min;
@ -31,6 +31,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
* FaceDetectionResult contains the detected faces, and the input {@link Bitmap} or {@link * FaceDetectionResult contains the detected faces, and the input {@link Bitmap} or {@link
* TextureFrame}. If not in static image mode, the timestamp field will be set to the timestamp of * TextureFrame}. If not in static image mode, the timestamp field will be set to the timestamp of

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.mediapipe.solutions.posetracking; package ca.copperlabs.mediapipe.posetracking;
import android.opengl.GLES20; import android.opengl.GLES20;
@ -26,7 +26,6 @@ import java.nio.ByteOrder;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** A custom implementation of {@link ResultGlRenderer} to render {@link PoseTrackingResult}. */ /** A custom implementation of {@link ResultGlRenderer} to render {@link PoseTrackingResult}. */

View File

@ -1,17 +0,0 @@
package com.google.mediapipe.solutions.posetracking;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@ -3,7 +3,7 @@ plugins {
} }
android { android {
namespace 'com.google.copperlabs_pose_detection' namespace 'ca.copperlabs.mediapipe.pose_detection'
compileSdk 32 compileSdk 32
defaultConfig { defaultConfig {

View File

@ -0,0 +1,17 @@
package ca.copperlabs.copperlabs_pose_detection;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@ -3,7 +3,7 @@ plugins {
} }
android { android {
namespace 'com.google.copperlabs_pose_graph' namespace 'ca.copperlabs.mediapipe.pose_graph'
compileSdk 32 compileSdk 32
defaultConfig { defaultConfig {

View File

@ -3,7 +3,7 @@ plugins {
} }
android { android {
namespace 'com.google.copperlabs_pose_landmark' namespace 'ca.copperlabs.mediapipe.pose_landmark'
compileSdk 32 compileSdk 32
defaultConfig { defaultConfig {

View File

@ -15,7 +15,7 @@ dependencyResolutionManagement {
rootProject.name = "posetracking" rootProject.name = "posetracking"
include ':app' include ':app'
include ':copperlabs-pose-api' include ':copperlabs-pose-api'
include ':copperlabs-lindera' include ':copperlabs-computer-vision'
include ':copperlabs-pose-landmark' include ':copperlabs-pose-landmark'
include ':copperlabs-pose-detection' include ':copperlabs-pose-detection'
include ':copperlabs-pose-graph' include ':copperlabs-pose-graph'