Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-129
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
2021-129
2021-129
Commits
1753d90e
Commit
1753d90e
authored
Nov 19, 2021
by
Samesh Buddhika Alahakoon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'IT18109672' into 'master'
bug fixes. See merge request
!38
parents
a155c886
fb0d9938
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
205 additions
and
99 deletions
+205
-99
app/src/main/java/com/app/smartphotoeditor/activities/AddEffects.java
.../java/com/app/smartphotoeditor/activities/AddEffects.java
+14
-3
app/src/main/java/com/app/smartphotoeditor/activities/AdjustBrightness.java
...com/app/smartphotoeditor/activities/AdjustBrightness.java
+13
-2
app/src/main/java/com/app/smartphotoeditor/activities/AdjustSaturation.java
...com/app/smartphotoeditor/activities/AdjustSaturation.java
+11
-2
app/src/main/java/com/app/smartphotoeditor/activities/CustomGallery.java
...va/com/app/smartphotoeditor/activities/CustomGallery.java
+16
-1
app/src/main/java/com/app/smartphotoeditor/activities/DenoisingActivity.java
...om/app/smartphotoeditor/activities/DenoisingActivity.java
+12
-2
app/src/main/java/com/app/smartphotoeditor/activities/EditorActivity.java
...a/com/app/smartphotoeditor/activities/EditorActivity.java
+17
-75
app/src/main/java/com/app/smartphotoeditor/activities/EnvironmentChecker.java
...m/app/smartphotoeditor/activities/EnvironmentChecker.java
+9
-1
app/src/main/java/com/app/smartphotoeditor/activities/LowLightEnhanceActivity.java
.../smartphotoeditor/activities/LowLightEnhanceActivity.java
+12
-2
app/src/main/java/com/app/smartphotoeditor/activities/RestorationActivity.java
.../app/smartphotoeditor/activities/RestorationActivity.java
+12
-2
app/src/main/java/com/app/smartphotoeditor/listeners/ml/OnEyeStatusChanged.java
...app/smartphotoeditor/listeners/ml/OnEyeStatusChanged.java
+2
-1
app/src/main/java/com/app/smartphotoeditor/listeners/ml/OnLandmarkResultChanged.java
...martphotoeditor/listeners/ml/OnLandmarkResultChanged.java
+1
-1
app/src/main/java/com/app/smartphotoeditor/services/ComputerVision.java
...ava/com/app/smartphotoeditor/services/ComputerVision.java
+4
-2
app/src/main/java/com/app/smartphotoeditor/vision/FacialLandmarkDetection.java
.../app/smartphotoeditor/vision/FacialLandmarkDetection.java
+79
-2
app/src/main/res/layout/activity_environment_checker.xml
app/src/main/res/layout/activity_environment_checker.xml
+3
-3
No files found.
app/src/main/java/com/app/smartphotoeditor/activities/AddEffects.java
View file @
1753d90e
...
...
@@ -407,10 +407,21 @@ public class AddEffects extends AppCompatActivity
}
// @Override
// public void onPupilChanged(Mat binary,int x, int y,int range,int pupilX)
// {
// findViewPoint(x,y);
// }
@Override
public
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
)
{
findViewPoint
(
x
,
y
);
public
void
eyeLeft
(
Mat
mat
)
{
}
@Override
public
void
eyeRight
(
Mat
mat
)
{
}
@Override
...
...
app/src/main/java/com/app/smartphotoeditor/activities/AdjustBrightness.java
View file @
1753d90e
...
...
@@ -265,10 +265,21 @@ public class AdjustBrightness extends AppCompatActivity
}
// @Override
// public void onPupilChanged(Mat binary, int x, int y, int range, int pupilX) {
//
// findViewPoint(x,y);
// }
@Override
public
void
eyeLeft
(
Mat
mat
)
{
}
@Override
public
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
)
{
public
void
eyeRight
(
Mat
mat
)
{
findViewPoint
(
x
,
y
);
}
@Override
...
...
app/src/main/java/com/app/smartphotoeditor/activities/AdjustSaturation.java
View file @
1753d90e
...
...
@@ -261,10 +261,19 @@ public class AdjustSaturation extends AppCompatActivity
}
// @Override
// public void onPupilChanged(Mat binary, int x, int y, int range, int pupilX) {
//
// findViewPoint(x,y);
// }
@Override
public
void
eyeLeft
(
Mat
mat
)
{
}
@Override
public
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
)
{
public
void
eyeRight
(
Mat
mat
)
{
findViewPoint
(
x
,
y
);
}
@Override
...
...
app/src/main/java/com/app/smartphotoeditor/activities/CustomGallery.java
View file @
1753d90e
...
...
@@ -350,8 +350,23 @@ public class CustomGallery extends AppCompatActivity implements
});
}
// @Override
// public void onPupilChanged(Mat binary,int x, int y,int range,int pupilX)
// {
// setPreviewFrame(binary);
// }
@Override
public
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
)
{
}
public
void
eyeLeft
(
Mat
mat
)
{
//setPreviewFrame(mat);
}
@Override
public
void
eyeRight
(
Mat
mat
)
{
//setPreviewFrame(mat);
}
@Override
public
void
onIdle
()
{
}
...
...
app/src/main/java/com/app/smartphotoeditor/activities/DenoisingActivity.java
View file @
1753d90e
...
...
@@ -306,10 +306,20 @@ public class DenoisingActivity extends AppCompatActivity
}
// @Override
// public void onPupilChanged(Mat binary, int x, int y, int range, int pupilX) {
//
// findViewPoint(x,y);
// }
@Override
public
void
eyeLeft
(
Mat
mat
)
{
}
@Override
public
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
)
{
public
void
eyeRight
(
Mat
mat
)
{
findViewPoint
(
x
,
y
);
}
@Override
...
...
app/src/main/java/com/app/smartphotoeditor/activities/EditorActivity.java
View file @
1753d90e
...
...
@@ -228,10 +228,25 @@ public class EditorActivity extends AppCompatActivity
}
// @Override
// public void onPupilChanged(Mat binary,int x, int y,int range, int pupilX) {
//
// findViewPoint(x,y);
// }
@Override
public
void
eyeLeft
(
Mat
mat
)
{
viewsInDisplay
.
get
(
1
).
setBackgroundColor
(
Color
.
RED
);
viewsInDisplay
.
get
(
0
).
setBackgroundColor
(
Color
.
TRANSPARENT
);
}
@Override
public
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
)
{
public
void
eyeRight
(
Mat
mat
)
{
findViewPoint
(
x
,
y
);
viewsInDisplay
.
get
(
0
).
setBackgroundColor
(
Color
.
RED
);
viewsInDisplay
.
get
(
1
).
setBackgroundColor
(
Color
.
TRANSPARENT
);
}
@Override
...
...
@@ -368,78 +383,5 @@ public class EditorActivity extends AppCompatActivity
}
});
}
void
findViewPoint
(
int
x
,
int
y
)
{
ImageView
cursor
=
findViewById
(
R
.
id
.
cursor
);
int
viewMaxX
=
0
;
int
viewMaxY
=
0
;
for
(
View
view
:
viewsInDisplay
)
{
int
[]
location
=
new
int
[
2
];
view
.
getLocationOnScreen
(
location
);
int
viewX
=
location
[
0
]
+
(
view
.
getWidth
()
/
2
);
int
viewY
=
location
[
1
]
/
2
;
if
(
viewX
>=
viewMaxX
)
{
viewMaxX
=
viewX
;
}
if
(
viewY
>=
viewMaxY
)
{
viewMaxY
=
viewY
;
}
}
if
(
x
>
viewMaxX
)
{
x
=
viewMaxX
;
}
if
(
y
>
viewMaxY
)
{
y
=
viewMaxY
;
}
for
(
View
view
:
viewsInDisplay
)
{
int
[]
location
=
new
int
[
2
];
view
.
getLocationOnScreen
(
location
);
int
viewX
=
location
[
0
];
int
viewY
=
location
[
1
];
int
viewMaxWidth
=
viewX
+
view
.
getWidth
();
int
viewMinWidth
=
viewX
-
view
.
getWidth
();
int
viewMaxHeight
=
viewY
+
view
.
getHeight
();
int
viewMinHeight
=
viewY
-
view
.
getHeight
();
if
((
x
>=
viewMinWidth
&&
x
<=
viewMaxWidth
))
{
view
.
setBackgroundColor
(
Color
.
RED
);
cursor
.
animate
().
x
((
viewMinWidth
+
viewMaxWidth
)
/
2
);
cursor
.
animate
().
y
((
viewMinHeight
+
viewMaxHeight
)
/
2
);
}
else
{
view
.
setBackgroundColor
(
Color
.
BLACK
);
}
}
cursor
.
animate
().
x
(
x
);
cursor
.
animate
().
y
(
y
);
}
}
\ No newline at end of file
app/src/main/java/com/app/smartphotoeditor/activities/EnvironmentChecker.java
View file @
1753d90e
...
...
@@ -161,7 +161,12 @@ public class EnvironmentChecker extends AppCompatActivity implements OnEyeStatus
}
@Override
public
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
)
{
public
void
eyeLeft
(
Mat
mat
)
{
}
@Override
public
void
eyeRight
(
Mat
mat
)
{
}
...
...
@@ -191,6 +196,7 @@ public class EnvironmentChecker extends AppCompatActivity implements OnEyeStatus
@Override
public
void
onRight
()
{
if
(!
isLeftDone
)
return
;
if
(!
isTopDone
)
return
;
runOnUiThread
(
new
Runnable
()
{
@Override
...
...
@@ -228,6 +234,8 @@ public class EnvironmentChecker extends AppCompatActivity implements OnEyeStatus
@Override
public
void
onBottom
()
{
if
(!
isLeftDone
)
return
;
if
(!
isRightDone
)
return
;
if
(!
isTopDone
)
return
;
runOnUiThread
(
new
Runnable
()
{
...
...
app/src/main/java/com/app/smartphotoeditor/activities/LowLightEnhanceActivity.java
View file @
1753d90e
...
...
@@ -354,10 +354,20 @@ public class LowLightEnhanceActivity extends AppCompatActivity
}
// @Override
// public void onPupilChanged(Mat binary, int x, int y, int range, int pupilX) {
//
// findViewPoint(x,y);
// }
@Override
public
void
eyeLeft
(
Mat
mat
)
{
}
@Override
public
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
)
{
public
void
eyeRight
(
Mat
mat
)
{
findViewPoint
(
x
,
y
);
}
@Override
...
...
app/src/main/java/com/app/smartphotoeditor/activities/RestorationActivity.java
View file @
1753d90e
...
...
@@ -321,10 +321,20 @@ public class RestorationActivity extends AppCompatActivity
}
// @Override
// public void onPupilChanged(Mat binary, int x, int y, int range, int pupilX) {
//
// findViewPoint(x,y);
// }
@Override
public
void
eyeLeft
(
Mat
mat
)
{
}
@Override
public
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
)
{
public
void
eyeRight
(
Mat
mat
)
{
findViewPoint
(
x
,
y
);
}
@Override
...
...
app/src/main/java/com/app/smartphotoeditor/listeners/ml/OnEyeStatusChanged.java
View file @
1753d90e
...
...
@@ -7,5 +7,6 @@ public interface OnEyeStatusChanged
void
opened
();
void
closed
();
void
longClosed
();
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
);
void
eyeLeft
(
Mat
mat
);
void
eyeRight
(
Mat
mat
);
}
app/src/main/java/com/app/smartphotoeditor/listeners/ml/OnLandmarkResultChanged.java
View file @
1753d90e
...
...
@@ -6,7 +6,7 @@ public interface OnLandmarkResultChanged
{
void
onSkeletonDrawn
(
Mat
mat
);
void
onEyeDetected
(
Mat
mat
);
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
);
void
onPupilChanged
(
Mat
binary
,
boolean
isLeft
,
boolean
isRight
);
void
onNoseChanged
(
int
x
,
int
y
);
}
app/src/main/java/com/app/smartphotoeditor/services/ComputerVision.java
View file @
1753d90e
...
...
@@ -116,9 +116,11 @@ public class ComputerVision
}
@Override
public
void
onPupilChanged
(
Mat
binary
,
int
x
,
int
y
,
int
range
,
int
pupilX
)
public
void
onPupilChanged
(
Mat
binary
,
boolean
isLeft
,
boolean
isRight
)
{
eyeStateListener
.
onPupilChanged
(
binary
,
x
,
y
,
range
,
pupilX
);
// eyeStateListener.eyeLeft(binary);
if
(
isLeft
)
eyeStateListener
.
eyeLeft
(
binary
);
if
(
isRight
)
eyeStateListener
.
eyeRight
(
binary
);
}
@Override
...
...
app/src/main/java/com/app/smartphotoeditor/vision/FacialLandmarkDetection.java
View file @
1753d90e
...
...
@@ -11,6 +11,7 @@ import com.app.smartphotoeditor.listeners.ml.OnLandmarkResultChanged;
import
com.app.smartphotoeditor.sdk.Methods
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.MatOfPoint
;
import
org.opencv.core.MatOfRect
;
...
...
@@ -35,6 +36,7 @@ import java.nio.ByteOrder;
import
java.nio.MappedByteBuffer
;
import
java.nio.channels.FileChannel
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
static
com
.
app
.
smartphotoeditor
.
config
.
Constants
.
EYE_END_POSITION_X
;
...
...
@@ -401,7 +403,7 @@ public class FacialLandmarkDetection
int
pupilY
=
(
int
)
(
p
.
get_m01
()
/
p
.
get_m00
());
findViewPoint
(
pupilX
,
pupilY
,
eyeStartingX
,
eyeEndingX
,
eyeStartingY
,
eyeEndingY
,
gray
);
findViewPoint
(
pupilX
,
pupilY
,
eyeStartingX
,
eyeEndingX
,
eyeStartingY
,
eyeEndingY
,
setDefaultValues
(
eye
)
);
//draw horizontal and vertical lines to create a cross
Imgproc
.
line
(
eye
,
new
Point
(
pupilX
-
5
,
pupilY
),
new
Point
(
pupilX
+
5
,
pupilY
),
new
Scalar
(
0
,
255
,
0
));
...
...
@@ -414,6 +416,81 @@ public class FacialLandmarkDetection
}
catch
(
Exception
e
)
{
}
}
public
Mat
setDefaultValues
(
Mat
srcMat
)
{
// final Bitmap bitmap = Bitmap.createBitmap(srcMat.clone().width(), srcMat.clone().height(), Bitmap.Config.ARGB_8888);
Imgproc
.
cvtColor
(
srcMat
,
srcMat
,
Imgproc
.
COLOR_BGR2GRAY
,
0
);
Mat
srcMat1
=
srcMat
;
Imgproc
.
GaussianBlur
(
srcMat1
,
srcMat1
,
new
Size
(
1
,
1
),
0
);
//Mat srcMat1 = new Mat(srcMat.rows(), srcMat.cols(), CV_8UC1);
//int kernalsize = 3;
//Imgproc.bilateralFilter(srcMat, srcMat1, kernalsize, kernalsize * 2, kernalsize / 2);
srcMat1
.
convertTo
(
srcMat1
,
0
,
1.9
,
1
);
srcMat1
.
convertTo
(
srcMat1
,
CvType
.
CV_8U
,
1.9
,
-
255
);
//Imgproc.cvtColor(srcMat1, srcMat1, Imgproc.COLOR_GRAY2RGBA, 4);
int
whiteCount
=
0
;
int
leftWhiteCount
=
0
;
int
rightWhiteCount
=
0
;
for
(
int
i
=
0
;
i
<
srcMat1
.
rows
();
i
++)
{
for
(
int
j
=
0
;
j
<
srcMat1
.
cols
();
j
++)
{
double
[]
pixel
=
srcMat1
.
get
(
i
,
j
);
double
value
=
pixel
[
0
];
if
(
value
<
200
)
{
srcMat1
.
row
(
i
).
col
(
j
).
setTo
(
new
Scalar
(
0
));
}
else
{
whiteCount
++;
if
(
i
<
5
)
{
rightWhiteCount
++;
}
if
(
i
>=
(
srcMat1
.
rows
()
-
2
))
{
leftWhiteCount
++;
}
}
}
}
Log
.
d
(
"cccccccccccccccc"
,
""
+
leftWhiteCount
+
" - "
+
rightWhiteCount
);
if
(
whiteCount
>=
22
)
{
if
(
rightWhiteCount
>
leftWhiteCount
)
{
Log
.
d
(
"cccccccccccccccc"
,
"right looked"
);
listener
.
onPupilChanged
(
srcMat1
,
false
,
true
);
}
else
{
Log
.
d
(
"cccccccccccccccc"
,
"left looked"
);
listener
.
onPupilChanged
(
srcMat1
,
true
,
false
);
}
// Log.d("cccccccccccccccc","" + leftWhiteCount + "-" + rightWhiteCount);
}
return
srcMat
;
}
private
void
drawConnectedLine
(
List
<
Point
>
points
,
Mat
skeletonMat
,
Scalar
scalar
)
{
...
...
@@ -529,7 +606,7 @@ public class FacialLandmarkDetection
listener
.
onPupilChanged
(
binary
,
calcX
,
calcY
,
range
,
pupilX
);
//
listener.onPupilChanged(binary,calcX,calcY,range,pupilX);
Log
.
d
(
"fsffsefsess"
,
"Y - "
+
pupilY
+
" Range - "
+
(
eyeEndY
-
eyeStartY
));
...
...
app/src/main/res/layout/activity_environment_checker.xml
View file @
1753d90e
...
...
@@ -30,13 +30,13 @@
android:layout_marginStart=
"32dp"
android:layout_marginTop=
"32dp"
android:layout_marginEnd=
"32dp"
android:gravity=
"
start
"
android:gravity=
"
center
"
android:letterSpacing=
"0.1"
android:lineSpacingMultiplier=
"1.2"
android:text=
"Pl
ease wait\nwhile we asses\nyour environment
"
android:text=
"Pl
ace you head \nmiddle of the screen
"
android:textAllCaps=
"true"
android:textColor=
"@color/white"
android:textSize=
"1
4
sp"
android:textSize=
"1
6
sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
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