Skip to content

Commit

Permalink
Fix: Update to Vuforia 7.5
Browse files Browse the repository at this point in the history
Changes for update Vuforia, fixed sample app for use the license from
intent, test for generate first Version
  • Loading branch information
Alberto Sainz Vegas committed Nov 29, 2018
1 parent b2adf4d commit 07692c3
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.gigigo.imagerecognition.vuforia.credentials.VuforiaCredentials
import com.gigigo.permissions.PermissionsActivity
import com.gigigo.permissions.exception.Error
import com.vuforia.TargetSearchResult
import javax.crypto.SecretKey

class ImageRecognizerActivity : AppCompatActivity(), VuforiaView.ResultHandler {

Expand Down Expand Up @@ -49,13 +50,13 @@ class ImageRecognizerActivity : AppCompatActivity(), VuforiaView.ResultHandler {
title = getString(R.string.imagerecognizer_vuforia_title)
}

// private fun getLicenseKey(): String = intent.getStringExtra(LICENSE_KEY)
// private fun getClientAccessKey(): String = intent.getStringExtra(CLIENT_ACCESS_KEY)
// private fun getClientSecretKey(): String = intent.getStringExtra(CLIENT_SECRET_KEY)
private fun getLicenseKey(): String = intent.getStringExtra(LICENSE_KEY)
private fun getClientAccessKey(): String = intent.getStringExtra(CLIENT_ACCESS_KEY)
private fun getClientSecretKey(): String = intent.getStringExtra(CLIENT_SECRET_KEY)

private val licenseKey = "AVF6Bi3/////AAAAmSHLdJe3ZUZrgF1Y5ckGTp07SkzjR9YT4Qk8ObwDTd8CYhZVdORRHtXUdAS/4HPnuu2mS+SxH1qG/gfDwVTOjcwfVtwW1fpzunmJ349wfW/SmRBA4EaWfqaU5eFQV1/wiMvaOmUuLc41TWKiuknpn8IVKtReE/uX67YiFtRt6GRRsp5DtMgseoC0rseFYujicHuGCnoRY/KB/ew2aaCQ8DJTcjIu7I6qHpizXsqBfH0EmHiDaMLgHBIBoxHqPqvo2W4fj8NIL47cBInSzpmjlI3N1SaJqGNFaI0A+8yv9HwOGGCDOVFQ0BPhU1U+y9QaMRbDnS8skxIPuVphEzqQm/tnYz+YW/SGDuidJYTq/Auy";
private val AccessKey: String = "efac882b322980f0959b72364d2e27eb4c402e12"
private val SecretKey: String = "dd3967639fe37ad9adf1060d8d274cebb0b226fb"
// private val licenseKey: String = "AX9Undz/////AAAACDK6kwxi7EuGsaT0cL4ZldgYjV3fE7Cb+Lh8Kb/UaGSWsfztzZqCqz3esySJezr/klkdnO3XxJoSAkvoAgU7t5JqYOoD5h2B+bleatSSi43sfMqBiEjXbpAJLplJPt/P5C/uGusgB6+0eELSGECCWfwZXMpSn7bGP3BKABNQG5kEEHUbD2w5q9cDfkGc8LsLACEqcUVChzQ2r+EZSGhs1gVUA5lqnyhBZbesjdq2YLunnKk+9+oGOfDNyra/SYpa8ucho0shOpCshigi5HmRfv+42D2DbmJX/gPY5o4yCvFMYlS8Ujf9eL54jHjvuk/gZpUaQCG620/FCJloZ+0pnuvnqFcgsSOvRA7aXd6hf4GS"
// private val clientAccessKey: String = "30e3675263a04e3ae11a47e0a8cfb01da0262f8c"
// private val clientSecretKey: String = "3d5e62875b15dd9261e5fc8d6c7882feced52037"


private fun initVuforia() {
Expand All @@ -65,7 +66,7 @@ class ImageRecognizerActivity : AppCompatActivity(), VuforiaView.ResultHandler {
override fun getApplicationContext(): Context = this@ImageRecognizerActivity.application.applicationContext
override fun isApplicationContextAvailable(): Boolean = true
}
credentials = VuforiaCredentials(licenseKey, AccessKey, SecretKey)
credentials = VuforiaCredentials(getLicenseKey(), getClientAccessKey(), getClientSecretKey())
var contentView = findViewById(R.id.content_frame)
vuforiaView = VuforiaView(this, contentView, contextProvider, credentials)
}
Expand Down
12 changes: 8 additions & 4 deletions app/src/main/java/com/gigigo/imagerecognition/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ import android.widget.TextView
class MainActivity : AppCompatActivity() {
private val IR_REQUEST_CODE = 1

private val licenseKey: String = "Abi5nL//////AAAAAXzdWR6MxEppinKbZ9qJjhU7Op5/+8Pwm8tdYfI4f3zFmRweYqowENwgiOUAtaiIH06OpQFISbhX9Linf/uq5JXUADO/MFrnbzy/UIuA3whurbD+Q18bV3uRrm2FtvF64fWdH7R1GoAbOEL6wbF621Da0JJ4uVYAZEYOga/6C4fBEtf0LpKoetdNIVpIxvWsIWHRNVWX41gbRTmwSqCnoV1axtSqBAalAx5Oq/GjoD4a8isoBRJMhkIEOR+4Q7lbyJrQatD+9TqINi9wAuBY9/atNKA27AzMpnQcuAaSr2rv8Y8r3wtk7yQY7oTm8CrBMLri+TdEZoF6Z/TdZaupRaqrlKZqtptOme0zoodbOTVe"
private val clientAccessKey: String = "fe4d316136ea6b7ee5faa72c4884e33805128b08"
private val clientSecretKey: String = "670f15bb4cd34c1621a892ced5321896c0b70df6"

// private val licenseKey: String = "Abi5nL//////AAAAAXzdWR6MxEppinKbZ9qJjhU7Op5/+8Pwm8tdYfI4f3zFmRweYqowENwgiOUAtaiIH06OpQFISbhX9Linf/uq5JXUADO/MFrnbzy/UIuA3whurbD+Q18bV3uRrm2FtvF64fWdH7R1GoAbOEL6wbF621Da0JJ4uVYAZEYOga/6C4fBEtf0LpKoetdNIVpIxvWsIWHRNVWX41gbRTmwSqCnoV1axtSqBAalAx5Oq/GjoD4a8isoBRJMhkIEOR+4Q7lbyJrQatD+9TqINi9wAuBY9/atNKA27AzMpnQcuAaSr2rv8Y8r3wtk7yQY7oTm8CrBMLri+TdEZoF6Z/TdZaupRaqrlKZqtptOme0zoodbOTVe"
// private val clientAccessKey: String = "fe4d316136ea6b7ee5faa72c4884e33805128b08"
// private val clientSecretKey: String = "670f15bb4cd34c1621a892ced5321896c0b70df6"

//asv test with ferringo keys 4 test
private val licenseKey: String = "AX9Undz/////AAAACDK6kwxi7EuGsaT0cL4ZldgYjV3fE7Cb+Lh8Kb/UaGSWsfztzZqCqz3esySJezr/klkdnO3XxJoSAkvoAgU7t5JqYOoD5h2B+bleatSSi43sfMqBiEjXbpAJLplJPt/P5C/uGusgB6+0eELSGECCWfwZXMpSn7bGP3BKABNQG5kEEHUbD2w5q9cDfkGc8LsLACEqcUVChzQ2r+EZSGhs1gVUA5lqnyhBZbesjdq2YLunnKk+9+oGOfDNyra/SYpa8ucho0shOpCshigi5HmRfv+42D2DbmJX/gPY5o4yCvFMYlS8Ujf9eL54jHjvuk/gZpUaQCG620/FCJloZ+0pnuvnqFcgsSOvRA7aXd6hf4GS"
private val clientAccessKey: String = "30e3675263a04e3ae11a47e0a8cfb01da0262f8c"
private val clientSecretKey: String = "3d5e62875b15dd9261e5fc8d6c7882feced52037"

private lateinit var licenseKeyTv: TextView
private lateinit var accessKeyTv: TextView
Expand Down
84 changes: 41 additions & 43 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,56 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ImageRecognizerActivity"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ImageRecognizerActivity">

<include layout="@layout/toolbar"/>
<include layout="@layout/toolbar" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/imagerecognizer_license_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="License key:"
/>
android:id="@+id/imagerecognizer_license_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="License key:" />

<TextView
android:id="@+id/imagerecognizer_accessKey_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Access key:"
/>
android:id="@+id/imagerecognizer_accessKey_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Access key:" />

<TextView
android:id="@+id/imagerecognizer_secretKey_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Secret key:"
/>
android:id="@+id/imagerecognizer_secretKey_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Secret key:" />

<TextView
android:id="@+id/imagerecognizer_code_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:id="@+id/imagerecognizer_code_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ff3300"
android:textStyle="bold" />

<Button
android:id="@+id/start_vuforia_button"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="40dp"
android:layout_marginLeft="64dp"
android:layout_marginRight="64dp"
android:layout_marginTop="40dp"
android:text="START VUFORIA"
style="@style/ButtonStyle"
/>
android:id="@+id/start_vuforia_button"
style="@style/ButtonStyle"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="40dp"
android:layout_marginLeft="64dp"
android:layout_marginRight="64dp"
android:layout_marginTop="40dp"
android:text="START VUFORIA" />
</LinearLayout>
</LinearLayout>
Binary file added vuforia.core/libs.rar
Binary file not shown.
Binary file modified vuforia.core/libs/Vuforia.jar
Binary file not shown.
Binary file modified vuforia.core/libs/armeabi-v7a/libVuforia.so
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public class CloudRecognition implements ApplicationControl {
private LoadingDialogHandler loadingDialogHandler;
public Activity mActivity;
private ICloudRecognitionCommunicator mCommunicator;

// declare scan line and its animation
public CloudRecognition(Activity activity, ICloudRecognitionCommunicator communicator,
String kAccessKey, String kSecretKey, String kLicenseKey, boolean showErrorMessages) {
Expand All @@ -89,13 +90,6 @@ public CloudRecognition(Activity activity, ICloudRecognitionCommunicator communi
}

//region methods 4 Focus
private int getHeight() {
return 1920;
}

private int getWidth() {
return 1080;
}

public boolean on_TouchEvent(MotionEvent e) {
return mGestureDetector.onTouchEvent(e);
Expand Down Expand Up @@ -602,7 +596,7 @@ public void onClick(DialogInterface dialog, int id) {

Trackable trackable = finder.enableTracking(result);

if (mExtendedTracking) trackable.startExtendedTracking();
// if (mExtendedTracking) trackable.startExtendedTracking();

//System.out.println("Vuforiaupdate finder.getResultCount");

Expand All @@ -629,9 +623,13 @@ public void onClick(DialogInterface dialog, int id) {
}

@Override public void onVuforiaStarted() {

//asv MUY IMPORTANTE, en vuforia 7.5 x culpa de algo de ARCore según veo por stackoverflow, el
//FOCUS_MODE_CONTINUOUSAUTO funciona mucho peor que el FOCUS_MODE_TRIGGERAUTO

//La primera opcion será FOCUS_MODE_TRIGGERAUTO
// Set camera focus mode
if (!CameraDevice.getInstance()
.setFocusMode(CameraDevice.FOCUS_MODE.FOCUS_MODE_CONTINUOUSAUTO)) {
if (!CameraDevice.getInstance().setFocusMode(CameraDevice.FOCUS_MODE.FOCUS_MODE_TRIGGERAUTO)) {
// If continuous autofocus mode fails, attempt to set to a different mode
if (!CameraDevice.getInstance()
.setFocusMode(CameraDevice.FOCUS_MODE.FOCUS_MODE_TRIGGERAUTO)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import android.opengl.Matrix;
import android.os.Build;
import android.util.Log;
import com.vuforia.COORDINATE_SYSTEM_TYPE;
import com.vuforia.CameraDevice;
import com.vuforia.Device;
import com.vuforia.GLTextureUnit;
Expand All @@ -35,6 +34,8 @@
import com.vuforia.VideoMode;
import com.vuforia.ViewList;

//import com.vuforia.COORDINATE_SYSTEM_TYPE;

public class SampleAppRenderer {

private static final String LOGTAG = "SampleAppRenderer";
Expand Down Expand Up @@ -180,9 +181,15 @@ public void render()

// Get projection matrix for the current view. COORDINATE_SYSTEM_CAMERA used for AR and
// COORDINATE_SYSTEM_WORLD for VR
//CameraCalibration cameraCalibration = new CameraCalibration(1,true);
//look https://library.vuforia.com/content/vuforia-library/en/reference/java/classcom_1_1vuforia_1_1COORDINATE__SYSTEM__TYPE.html

//Matrix34F
// projMatrix = mRenderingPrimitives.getProjectionMatrix(viewID, COORDINATE_SYSTEM_TYPE.COORDINATE_SYSTEM_CAMERA,
// state.getCameraCalibration());

Matrix34F
projMatrix = mRenderingPrimitives.getProjectionMatrix(viewID, COORDINATE_SYSTEM_TYPE.COORDINATE_SYSTEM_CAMERA,
state.getCameraCalibration());
projMatrix = mRenderingPrimitives.getProjectionMatrix(viewID, state.getCameraCalibration());

// Create GL matrix setting up the near and far planes
float rawProjectionMatrixGL[] = Tool.convertPerspectiveProjection2GLMatrix(
Expand Down Expand Up @@ -281,8 +288,8 @@ public void render()
}
mRenderer.end();
}
*/
}*/

public void setNearFarPlanes(float near, float far)
{
mNearPlane = near;
Expand All @@ -304,7 +311,7 @@ public void renderVideoBackground()
}

float[] vbProjectionMatrix = Tool.convert2GLMatrix(
mRenderingPrimitives.getVideoBackgroundProjectionMatrix(currentView, COORDINATE_SYSTEM_TYPE.COORDINATE_SYSTEM_CAMERA)).getData();
mRenderingPrimitives.getVideoBackgroundProjectionMatrix(currentView )).getData();

// Apply the scene scale on video see-through eyewear, to scale the video background and augmentation
// so that the display lines up with the real world
Expand Down Expand Up @@ -381,7 +388,7 @@ public void configureVideoBackground()
VideoMode vm = cameraDevice.getVideoMode(CameraDevice.MODE.MODE_DEFAULT);

VideoBackgroundConfig config = new VideoBackgroundConfig();
config.setEnabled(true);
//config..setEnabled(true);
config.setPosition(new Vec2I(0, 0));

int xSize = 0, ySize = 0;
Expand Down

0 comments on commit 07692c3

Please sign in to comment.