Commit 2242bd73 authored by ranthilina99's avatar ranthilina99

update growth height and python

parent 15680fad
/build /build
/src/main/assets /src/main/assets/model.tflite
\ No newline at end of file \ No newline at end of file
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.EKetha"> android:theme="@style/Theme.EKetha">
<activity android:name=".SplashScreen" <activity
android:name=".SplashScreen"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
...@@ -33,10 +34,9 @@ ...@@ -33,10 +34,9 @@
<activity android:name=".GrowthThreatment" /> <activity android:name=".GrowthThreatment" />
<activity android:name=".GrowthDetect" /> <activity android:name=".GrowthDetect" />
<activity android:name=".Admin" /> <activity android:name=".Admin" />
<activity android:name=".growthHome" />
<activity android:name=".Growth" /> <activity android:name=".Growth" />
<activity android:name=".Register" /> <activity android:name=".Register" />
<activity android:name=".Login"/> <activity android:name=".Login" />
<activity android:name=".MainActivity" /> <activity android:name=".MainActivity" />
<provider <provider
......
...@@ -13,6 +13,7 @@ import android.util.Base64; ...@@ -13,6 +13,7 @@ import android.util.Base64;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Toast;
import com.chaquo.python.PyObject; import com.chaquo.python.PyObject;
import com.chaquo.python.Python; import com.chaquo.python.Python;
...@@ -21,6 +22,8 @@ import com.chaquo.python.android.AndroidPlatform; ...@@ -21,6 +22,8 @@ import com.chaquo.python.android.AndroidPlatform;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.lang.reflect.Array;
import java.util.ArrayList;
public class GrowthHeight extends AppCompatActivity { public class GrowthHeight extends AppCompatActivity {
...@@ -127,13 +130,25 @@ public class GrowthHeight extends AppCompatActivity { ...@@ -127,13 +130,25 @@ public class GrowthHeight extends AppCompatActivity {
PyObject pyo = py.getModule("height"); PyObject pyo = py.getModule("height");
PyObject obj = pyo.callAttr("main", imageString); PyObject obj = pyo.callAttr("main", imageString);
//System.out.println("-----------------------------------");
System.out.println(obj);
// ArrayList<PyObject> arrayList = new ArrayList<PyObject>();
// System.out.println("-----------------------------------");
// arrayList.add(obj);
// System.out.println(arrayList);
String str = obj.toString(); String str = obj.toString();
//System.out.println("-----------------------------------");
//System.out.println(obj);
//System.out.println(str);
//System.out.println("33333333333333333333333333333333333 ");
if(str.equals("abc")){
Toast.makeText(this, "Please upload quality image", Toast.LENGTH_SHORT).show();
// Intent intent = new Intent(GrowthHeight.this, growthHome.class);
// startActivity(intent);
}else{
byte data[] = Base64.decode(str, Base64.DEFAULT); byte data[] = Base64.decode(str, Base64.DEFAULT);
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length); Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
outputImage = bmp; outputImage = bmp;
} }
}
} }
\ No newline at end of file
...@@ -37,6 +37,7 @@ def main(data): ...@@ -37,6 +37,7 @@ def main(data):
(cnts, _) = contours.sort_contours(cnts) (cnts, _) = contours.sort_contours(cnts)
cnts = [x for x in cnts if cv2.contourArea(x) >2000] cnts = [x for x in cnts if cv2.contourArea(x) >2000]
if len(cnts)>0 :
ref_object = cnts[0] ref_object = cnts[0]
box = cv2.minAreaRect(ref_object) box = cv2.minAreaRect(ref_object)
box = cv2.boxPoints(box) box = cv2.boxPoints(box)
...@@ -68,3 +69,5 @@ def main(data): ...@@ -68,3 +69,5 @@ def main(data):
img_str = base64.b64encode(buff.getvalue()) img_str = base64.b64encode(buff.getvalue())
return ""+str(img_str, 'utf-8') return ""+str(img_str, 'utf-8')
else :
return "abc"
\ No newline at end of file
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