Commit f0b735ad authored by ranthilina99's avatar ranthilina99

modified ui and added distance of height

parent 01c39208
......@@ -23,7 +23,7 @@ android {
}
python {
buildPython "D:/Python/python.exe"
buildPython "C:/python/python.exe"
pip {
install "opencv-contrib-python-headless"
install "pillow"
......
......@@ -22,35 +22,16 @@
<application
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.EKetha">
<activity
android:name=".Pests"
android:exported="false" />
<activity
android:name=".Diseases"
android:exported="false" />
<activity
android:name=".pdHome"
android:exported="false" />
<activity
android:name=".WeedMain"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".WeedHome"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity android:name=".WeedHome"></activity>
<activity android:name=".WeedMain" />
<activity android:name=".Diseases" />
<activity android:name=".Pests" />
<activity android:name=".pdHome" />
<activity
android:name=".PaddyArea.PaddyAreaView_04"
android:exported="false" />
......
This is our model details please downlaod the model.tflite this folder
https://drive.google.com/drive/folders/1d38y53lNSWnwLvQGDqi98N6yW0_LqZ0D?usp=share_link
\ No newline at end of file
......@@ -10,6 +10,7 @@ import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
......@@ -101,9 +102,8 @@ public class GrowthDetect extends AppCompatActivity {
btnTreatment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Intent intent2 = new Intent(GrowthDetect.this, Weeds.class);
// startActivity(intent2);
Intent intent2 = new Intent(GrowthDetect.this, WeedHome.class);
startActivity(intent2);
}
});
}
......
......@@ -12,6 +12,7 @@ import android.os.Handler;
import android.util.Base64;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
......@@ -35,8 +36,9 @@ public class GrowthHeight extends AppCompatActivity {
private ImageView imageView1;
private BitmapDrawable drawable;
private String imageString;
private String value;
private String value,distination;
private TextView textView;
private EditText editText;
private static final DecimalFormat df = new DecimalFormat("0.00");
@Override
......@@ -48,6 +50,10 @@ public class GrowthHeight extends AppCompatActivity {
btnHeight = findViewById(R.id.button3);
btnThreatment = findViewById(R.id.button2);
textView = findViewById(R.id.resulttextRice);
editText =findViewById(R.id.resultEditRicevalue);
btnThreatment.setEnabled(false);
imageView1.setEnabled(false);
if (! Python.isStarted()) {
Python.start(new AndroidPlatform(this));
......@@ -92,8 +98,15 @@ public class GrowthHeight extends AppCompatActivity {
btnHeight.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
distination= editText.getText().toString();
System.out.println(editText.getText().toString());
if(distination.isEmpty()){
Toast.makeText(GrowthHeight.this, "Please Enter the distance", Toast.LENGTH_SHORT).show();
}else{
btnThreatment.setEnabled(true);
autoDenoiseImage();
}
}
});
}
private void autoDenoiseImage() {
......@@ -135,10 +148,10 @@ public class GrowthHeight extends AppCompatActivity {
imageString = getStringImage(inputImage);
PyObject pyo = py.getModule("height");
PyObject obj = pyo.callAttr("main", imageString);
PyObject obj = pyo.callAttr("main", imageString,distination);
PyObject pyo1 = py.getModule("measurement");
PyObject obj1= pyo1.callAttr("main", imageString);
PyObject obj1= pyo1.callAttr("main", imageString,distination);
//System.out.println("-----------------------------------");
System.out.println(obj);
System.out.println(obj1);
......
......@@ -2,9 +2,12 @@ package com.example.eketha;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
......@@ -14,6 +17,7 @@ public class GrowthThreatment extends AppCompatActivity {
private Bitmap inputImage;
private ImageView imageView1;
private TextView textView,textView1;
private Button back;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -22,10 +26,19 @@ public class GrowthThreatment extends AppCompatActivity {
imageView1 = findViewById(R.id.treatImg);
textView = findViewById(R.id.treatText4Rice);
textView1 = findViewById(R.id.treatText5Rice);
back = findViewById(R.id.thretmentRiceBack);
String result = getIntent().getStringExtra("results");
textView.setText(result);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(GrowthThreatment.this, MainActivity.class);
startActivity(intent);
}
});
String filename = getIntent().getStringExtra("image");
try {
FileInputStream is = this.openFileInput(filename);
......@@ -39,27 +52,27 @@ public class GrowthThreatment extends AppCompatActivity {
Double df = Double.parseDouble(textView.getText().toString());
String details="";
if(df>=10 || df<20){
if(df>=10 && df<20){
details=getResources().getString(R.string.treatment1);
textView1.setText(details);
}else if(df>=10 || df<30){
}else if(df>=20 && df<30){
details=getResources().getString(R.string.treatment2);
textView1.setText(details);
}else if(df>=30 || df<50){
}else if(df>=30 && df<50){
details=getResources().getString(R.string.treatment3);
textView1.setText(details);
}else if(df>=50 || df<70){
}else if(df>=50 && df<70){
details=getResources().getString(R.string.treatment4);
textView1.setText(details);
}else if(df>=70 || df<90){
}else if(df>=70 && df<90){
details=getResources().getString(R.string.treatment5);
textView1.setText(details);
}else if(df>=90 || df<=100){
}else if(df>=90){
details=getResources().getString(R.string.treatment6);
textView1.setText(details);
}
......
......@@ -50,7 +50,7 @@ public class MainActivity extends AppCompatActivity {
startActivity(intent);
}
});
//
cardView3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......
......@@ -29,12 +29,12 @@ public class fertilizerHome extends AppCompatActivity {
}
});
layer2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), PaddyAreaHome.class);
startActivity(intent);
}
});
// layer2.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// Intent intent = new Intent(getApplicationContext(), PaddyAreaHome.class);
// startActivity(intent);
// }
// });
}
}
\ No newline at end of file
This is our model details please downlaod the models
download the bmodel,Dmodel,pestmodel,modelres four model download in this folder
https://drive.google.com/drive/folders/1d38y53lNSWnwLvQGDqi98N6yW0_LqZ0D?usp=share_link
\ No newline at end of file
......@@ -14,7 +14,7 @@ def show_images(images):
for i, img in enumerate(images):
cv2.imshow("image_" + str(i), img)
def main(data):
def main(data,distance):
#decode the image
decoded_data = base64.b64decode(data)
......@@ -44,7 +44,7 @@ def main(data):
box = perspective.order_points(box)
(tl, tr, br, bl) = box
dist_in_pixel = euclidean(tl, tr)
dist_in_cm =10
dist_in_cm =float(distance)
pixel_per_cm = dist_in_pixel/dist_in_cm
for cnt in cnts:
box = cv2.minAreaRect(cnt)
......
......@@ -14,7 +14,7 @@ def show_images(images):
for i, img in enumerate(images):
cv2.imshow("image_" + str(i), img)
def main(data):
def main(data,distance):
#decode the image
decoded_data = base64.b64decode(data)
......@@ -45,7 +45,7 @@ def main(data):
box = perspective.order_points(box)
(tl, tr, br, bl) = box
dist_in_pixel = euclidean(tl, tr)
dist_in_cm =10
dist_in_cm =float(distance)
pixel_per_cm = dist_in_pixel/dist_in_cm
for cnt in cnts:
box = cv2.minAreaRect(cnt)
......
......@@ -4,28 +4,26 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
tools:context=".Diseases">
<Button
android:id="@+id/btnTakePicture"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="68dp"
android:layout_above="@id/btnLaunchGallery"
android:layout_centerInParent="true"
android:background="@drawable/round_bg"
android:text="Take Picture"
android:textAllCaps="false"
android:textSize="21sp"
android:textStyle="bold" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="68dp"
android:layout_centerInParent="true"
android:id="@+id/btnLaunchGallery"
android:background="@drawable/round_bg"
android:text="Launch Gallery"
android:textAllCaps="false"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_alignParentBottom="true"
android:textSize="21sp"
......
......@@ -4,21 +4,18 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
tools:context=".Fertilizer">
<Button
android:id="@+id/button3"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true"
android:layout_marginStart="50dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="50dp"
android:layout_marginBottom="14dp"
android:background="@drawable/round_bg"
android:text="Area"
android:textAllCaps="false"
android:textSize="21sp"
......@@ -26,14 +23,11 @@
<Button
android:id="@+id/button"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_above="@+id/button2"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:background="@drawable/round_bg"
android:text="Take Picture"
android:textAllCaps="false"
android:textSize="21sp"
......@@ -41,17 +35,11 @@
<Button
android:id="@+id/button2"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true"
android:layout_marginStart="50dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="50dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="65dp"
android:background="@drawable/round_bg"
android:text="Launch Gallery"
android:textAllCaps="false"
android:textSize="21sp"
......
......@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/back"
tools:context=".fertilizerHome">
<LinearLayout
......@@ -21,12 +22,13 @@
app:srcCompat="@drawable/logo" />
<TextView
android:textStyle="italic"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Fertilizer Home"
android:text="Fertilizer Management"
android:textColor="@color/black"
android:layout_marginTop="10dp"
android:layout_marginLeft="100dp"
android:layout_marginLeft="50dp"
android:textSize="30dp"/>
</LinearLayout>
......@@ -72,45 +74,45 @@
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="173dp"
android:layout_marginRight="30dp"
app:cardCornerRadius="8dp"
android:layout_marginTop="30dp"
android:layout_marginLeft="30dp">
<!-- <androidx.cardview.widget.CardView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="173dp"-->
<!-- android:layout_marginRight="30dp"-->
<!-- app:cardCornerRadius="8dp"-->
<!-- android:layout_marginTop="30dp"-->
<!-- android:layout_marginLeft="30dp">-->
<LinearLayout
android:id="@+id/layer3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/black">
<!-- <LinearLayout-->
<!-- android:id="@+id/layer3"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="vertical"-->
<!-- android:background="@color/black">-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="30dp"
android:layout_marginTop="20dp"
android:layout_marginRight="30dp">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
app:srcCompat="@drawable/logo" />
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal"-->
<!-- android:layout_marginLeft="30dp"-->
<!-- android:layout_marginTop="20dp"-->
<!-- android:layout_marginRight="30dp">-->
<!-- <ImageView-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="100dp"-->
<!-- android:layout_marginLeft="10dp"-->
<!-- android:layout_marginTop="10dp"-->
<!-- app:srcCompat="@drawable/logo" />-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="36dp"
android:textColor="@color/white"
android:text="Paddy Area"/>
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:textSize="24dp"-->
<!-- android:layout_marginLeft="20dp"-->
<!-- android:layout_marginTop="36dp"-->
<!-- android:textColor="@color/white"-->
<!-- android:text="Paddy Area"/>-->
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- </LinearLayout>-->
<!-- </LinearLayout>-->
<!-- </androidx.cardview.widget.CardView>-->
</LinearLayout>
\ No newline at end of file
......@@ -48,6 +48,19 @@
android:layout_below="@+id/imageHeightView"
android:textStyle="bold" />
<EditText
android:id="@+id/resultEditRicevalue"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:hint="Enter the distance"
android:textAlignment="center"
android:textColor="#212121"
android:textSize="15dp"
android:inputType="numberDecimal"
android:layout_below="@+id/resulttextRice"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
......
......@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/back"
tools:context=".growthHome">
<LinearLayout
......@@ -73,6 +74,4 @@
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
\ No newline at end of file
......@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
tools:context=".GrowthThreatment">
......@@ -82,5 +83,17 @@
android:textSize="15dp">
</TextView>
<Button
android:id="@+id/thretmentRiceBack"
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="108dp"
android:text="Back"
android:textAllCaps="false"
android:textSize="21sp"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
\ No newline at end of file
......@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/back"
tools:context=".Login">
<LinearLayout
......
......@@ -3,13 +3,12 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/green"
tools:context=".MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back6">
android:background="@drawable/back">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
......
......@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/back"
tools:context=".pdHome">
......@@ -24,10 +25,12 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Pest and Diseases Home"
android:text="Pest and Diseases Management"
android:textColor="@color/black"
android:textAlignment="center"
android:textStyle="italic"
android:layout_marginTop="10dp"
android:layout_marginLeft="50dp"
android:layout_marginLeft="20dp"
android:textSize="30dp"/>
</LinearLayout>
......
......@@ -4,16 +4,16 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
tools:context=".Pests">
<Button
android:id="@+id/btnTakePicturePests"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/btnLaunchGalleryPests"
android:layout_centerInParent="true"
android:background="@drawable/round_bg"
android:text="Take Picture"
android:layout_height="68dp"
android:textAllCaps="false"
android:textSize="21sp"
android:textStyle="bold" />
......@@ -21,12 +21,10 @@
<Button
android:id="@+id/btnLaunchGalleryPests"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_height="68dp" android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginTop="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:background="@drawable/round_bg"
android:text="Launch Gallery"
android:textAllCaps="false"
android:textSize="21sp"
......
......@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/back"
tools:context=".Register">
<LinearLayout
......
......@@ -5,7 +5,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".weedHome">
android:background="@drawable/back"
tools:context=".weeHome">
<LinearLayout
......@@ -22,6 +23,7 @@
app:srcCompat="@drawable/logo" />
<TextView
android:textStyle="italic"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Weed Management"
......
......@@ -49,6 +49,7 @@
• OAntibiotic injections. And increase the fertilizer.\n\n
</string>
<string name="treatment6">
• OAntibiotic injections. And increase the fertilizer.\n\n
• As the height of the rice grown to the require size\n\n
please cut of the plants.\n\n
</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment