Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Augmented Reality Chemistry Laboratory
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
1
Merge Requests
1
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
2021-189
Augmented Reality Chemistry Laboratory
Commits
f6f14a6d
Commit
f6f14a6d
authored
Jul 01, 2021
by
Charuka_IT18114454
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resizing captured image and fix issues.
parent
68a9552b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
4 deletions
+31
-4
app/src/main/python/preprosessgreyscale.py
app/src/main/python/preprosessgreyscale.py
+29
-2
app/src/main/res/layout/activity_image_process.xml
app/src/main/res/layout/activity_image_process.xml
+2
-2
No files found.
app/src/main/python/preprosessgreyscale.py
View file @
f6f14a6d
...
...
@@ -5,9 +5,12 @@ import base64
import
io
def
main
(
data
):
decoded_data
=
base64
.
b64decode
(
data
)
np_data
=
np
.
fromstring
(
decoded_data
,
np
.
uint8
)
img
=
cv2
.
imdecode
(
np_data
,
cv2
.
IMREAD_UNCHANGED
)
img
=
cv2
.
resize
(
img
,
(
100
,
100
))
img_gray
=
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_BGR2GRAY
)
...
...
@@ -15,8 +18,32 @@ def main(data):
pil_im
=
cv2
.
dilate
(
img_gray
,
kernel
,
iterations
=
1
)
pil_im
=
cv2
.
erode
(
pil_im
,
kernel
,
iterations
=
1
)
# pil_im = cv2.adaptiveThreshold(cv2.medianBlur(pil_im, 5), 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 31, 5)
pil_im
=
cv2
.
threshold
(
cv2
.
GaussianBlur
(
pil_im
,
(
9
,
9
),
0
),
0
,
255
,
cv2
.
THRESH_BINARY
+
cv2
.
THRESH_OTSU
)[
1
]
pil_im
=
cv2
.
morphologyEx
(
pil_im
,
cv2
.
MORPH_OPEN
,
kernel
)
#pil_im = cv2.morphologyEx(pil_im, cv2.MORPH_CLOSE, kernel)
#pil_im = ImageEnhance.Brightness(pil_im)
#pil_im = ImageEnhance.Color(pil_im)
# pil_im = ImageEnhance.Contrast(pil_im)
# Rebuild ImageEnhance.Brightness on-the-fly
#pil_im = Image.new(pil_im.mode, pil_im.size, 0)
#pil_im = Image.blend(pil_im, pil_im, factor)
#image = Image.open(np_data)
#pil_im = ImageEnhance.Contrast(image)
pil_im
=
cv2
.
GaussianBlur
(
pil_im
,(
5
,
5
),
0
)
pil_im
=
cv2
.
medianBlur
(
pil_im
,
5
)
pil_im
=
cv2
.
adaptiveThreshold
(
pil_im
,
255
,
cv2
.
ADAPTIVE_THRESH_GAUSSIAN_C
,
cv2
.
THRESH_BINARY
,
11
,
2
)
#pil_im= cv2.threshold(pil_im,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
#pil_im = cv2.threshold(cv2.GaussianBlur(pil_im, (9, 9), 0), 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]
pil_im
=
Image
.
fromarray
(
pil_im
)
...
...
app/src/main/res/layout/activity_image_process.xml
View file @
f6f14a6d
...
...
@@ -22,7 +22,7 @@
android:id=
"@+id/capture"
android:layout_width=
"243dp"
android:layout_height=
"66dp"
android:text=
"
Butto
n"
android:text=
"
Sca
n"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
@@ -45,7 +45,7 @@
android:id=
"@+id/textfinal"
android:layout_width=
"287dp"
android:layout_height=
"71dp"
android:text=
"
TextView
"
android:text=
""
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
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