Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-81
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2022-81
2022-81
Commits
2242bd73
Commit
2242bd73
authored
Oct 09, 2022
by
ranthilina99
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update growth height and python
parent
15680fad
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
37 deletions
+57
-37
app/.gitignore
app/.gitignore
+1
-1
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-3
app/src/main/assets/dictT.txt
app/src/main/assets/dictT.txt
+2
-0
app/src/main/java/com/example/eketha/GrowthHeight.java
app/src/main/java/com/example/eketha/GrowthHeight.java
+22
-7
app/src/main/python/height.py
app/src/main/python/height.py
+29
-26
No files found.
app/.gitignore
View file @
2242bd73
/build
/src/main/assets
\ No newline at end of file
/src/main/assets/model.tflite
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
2242bd73
...
...
@@ -21,7 +21,8 @@
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.EKetha"
>
<activity
android:name=
".SplashScreen"
<activity
android:name=
".SplashScreen"
android:exported=
"true"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
@@ -33,10 +34,9 @@
<activity
android:name=
".GrowthThreatment"
/>
<activity
android:name=
".GrowthDetect"
/>
<activity
android:name=
".Admin"
/>
<activity
android:name=
".growthHome"
/>
<activity
android:name=
".Growth"
/>
<activity
android:name=
".Register"
/>
<activity
android:name=
".Login"
/>
<activity
android:name=
".Login"
/>
<activity
android:name=
".MainActivity"
/>
<provider
...
...
app/src/main/assets/dictT.txt
0 → 100644
View file @
2242bd73
rice
weed
app/src/main/java/com/example/eketha/GrowthHeight.java
View file @
2242bd73
...
...
@@ -13,6 +13,7 @@ import android.util.Base64;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.Toast
;
import
com.chaquo.python.PyObject
;
import
com.chaquo.python.Python
;
...
...
@@ -21,6 +22,8 @@ import com.chaquo.python.android.AndroidPlatform;
import
java.io.ByteArrayOutputStream
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.lang.reflect.Array
;
import
java.util.ArrayList
;
public
class
GrowthHeight
extends
AppCompatActivity
{
...
...
@@ -127,13 +130,25 @@ public class GrowthHeight extends AppCompatActivity {
PyObject
pyo
=
py
.
getModule
(
"height"
);
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
();
//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
);
Bitmap
bmp
=
BitmapFactory
.
decodeByteArray
(
data
,
0
,
data
.
length
);
outputImage
=
bmp
;
}
}
}
\ No newline at end of file
app/src/main/python/height.py
View file @
2242bd73
...
...
@@ -37,6 +37,7 @@ def main(data):
(
cnts
,
_
)
=
contours
.
sort_contours
(
cnts
)
cnts
=
[
x
for
x
in
cnts
if
cv2
.
contourArea
(
x
)
>
2000
]
if
len
(
cnts
)
>
0
:
ref_object
=
cnts
[
0
]
box
=
cv2
.
minAreaRect
(
ref_object
)
box
=
cv2
.
boxPoints
(
box
)
...
...
@@ -68,3 +69,5 @@ def main(data):
img_str
=
base64
.
b64encode
(
buff
.
getvalue
())
return
""
+
str
(
img_str
,
'utf-8'
)
else
:
return
"abc"
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment