10.31 update_app_test
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/ChooseImageButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ChooseImageButton"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,111 @@
|
||||
package com.echo.appliaction_test;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.echo.appliaction_test.databinding.ImageInformationBinding;
|
||||
|
||||
import org.tensorflow.lite.support.image.TensorImage;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Author: WangYuyang
|
||||
* @Date: 2021/10/31-14:53
|
||||
* @Project: My Application
|
||||
* @Package: com.echo.appliaction_test
|
||||
* @Description:
|
||||
**/
|
||||
public class Image_information_activity extends AppCompatActivity {
|
||||
private ImageInformationBinding binding;
|
||||
private Image_information_activity _this = this;
|
||||
private String sourceFilePath;
|
||||
private Bitmap image;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
binding = ImageInformationBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
Intent intent = getIntent();
|
||||
sourceFilePath = intent.getStringExtra("sourceFilePath");
|
||||
image = BitmapFactory.decodeFile(sourceFilePath);
|
||||
TensorImage Timage = TensorImage.fromBitmap(image);
|
||||
|
||||
binding.imageView2.setImageBitmap(image);
|
||||
TextView information = new TextView(this);
|
||||
information.append("getHeight: " + image.getHeight());
|
||||
information.append("\n");
|
||||
information.append("getWidth: " + image.getWidth());
|
||||
information.append("\n");
|
||||
information.append("describeContents: " + image.describeContents());
|
||||
information.append("\n");
|
||||
information.append("getRowBytes: " + image.getRowBytes());
|
||||
information.append("\n");
|
||||
information.append("hasAlpha: " + image.hasAlpha());
|
||||
information.append("\n");
|
||||
information.append("hasMipMap: " + image.hasMipMap());
|
||||
information.append("\n");
|
||||
information.append("isPremultiplied: " + image.isPremultiplied());
|
||||
information.append("\n");
|
||||
information.append("isMutable: " + image.isMutable());
|
||||
information.append("\n");
|
||||
information.append("isRecycled: " + image.isRecycled());
|
||||
information.append("\n");
|
||||
information.append("toString: " + image.toString());
|
||||
information.append("\n");
|
||||
information.append("getAllocationByteCount: " + image.getAllocationByteCount());
|
||||
information.append("\n");
|
||||
information.append("getByteCount: " + image.getByteCount());
|
||||
information.append("\n");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
information.append("getColorSpace: " + image.getColorSpace());
|
||||
}
|
||||
information.append("\n");
|
||||
information.append("getConfig: " + image.getConfig());
|
||||
information.append("\n");
|
||||
information.append("getDensity: " + image.getDensity());
|
||||
information.append("\n");
|
||||
information.append("getGenerationId: " + image.getGenerationId());
|
||||
information.append("\n");
|
||||
information.append("-----------------Tensor---------------------");
|
||||
information.append("\n");
|
||||
information.append("getDataType: " + Timage.getDataType());
|
||||
information.append("\n");
|
||||
information.append("getDataType.byteSize: " + Timage.getDataType().byteSize());
|
||||
information.append("\n");
|
||||
information.append("toString: " + Timage.toString());
|
||||
information.append("\n");
|
||||
information.append("getFlatSize: " + Timage.getTensorBuffer().getFlatSize());
|
||||
information.append("\n");
|
||||
information.append("getShape: " + Arrays.toString(Timage.getTensorBuffer().getShape()));
|
||||
information.append("\n");
|
||||
information.append("getTypeSize: " + Timage.getTensorBuffer().getTypeSize());
|
||||
information.append("\n");
|
||||
information.append("isDynamic: " + Timage.getTensorBuffer().isDynamic());
|
||||
information.append("\n");
|
||||
if (Timage.getTensorBuffer().getFlatSize() < 10000000) {
|
||||
information.append("getIntArray length: " + Timage.getTensorBuffer().getIntArray().length);
|
||||
information.append("\n");
|
||||
int[] array;
|
||||
if (Timage.getTensorBuffer().getIntArray().length > 200)
|
||||
array = Arrays.copyOfRange(Timage.getTensorBuffer().getIntArray(), 0, 200);
|
||||
else
|
||||
array = Timage.getTensorBuffer().getIntArray();
|
||||
information.append("getIntArray(0..200): " + Arrays.toString(array));
|
||||
}
|
||||
|
||||
|
||||
binding.informationArea.addView(information);
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/ChooseImageButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="DEBUG_PhotoEditor"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/ImageInformationButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="Image_Information"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ChooseImageButton" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/game_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="DEBUG_Game"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ImageInformationButton" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:fontFamily="serif-monospace"
|
||||
android:text="TextView"
|
||||
android:textSize="34sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/ChooseImageButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:fontFamily="serif-monospace"
|
||||
android:text="TextView"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2"
|
||||
app:layout_wrapBehaviorInParent="included" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginTop="32dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:srcCompat="@tools:sample/avatars" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView2"
|
||||
tools:ignore="SpeakableTextPresentCheck">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/information_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 982 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |