cleaned unnecessary drawings
This commit is contained in:
parent
cb9c9e4712
commit
e72fb8a6be
|
@ -73,18 +73,22 @@ public class PoseTrackingResultGlRenderer implements ResultGlRenderer<PoseTracki
|
||||||
colorHandle = GLES20.glGetUniformLocation(program, "uColor");
|
colorHandle = GLES20.glGetUniformLocation(program, "uColor");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No needed anymore to be deleted
|
||||||
|
* **/
|
||||||
@Override
|
@Override
|
||||||
public void renderResult(PoseTrackingResult result, float[] projectionMatrix) {
|
public void renderResult(PoseTrackingResult result, float[] projectionMatrix) {
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLES20.glUseProgram(program);
|
GLES20.glUseProgram(program);
|
||||||
GLES20.glUniformMatrix4fv(projectionMatrixHandle, 1, false, projectionMatrix, 0);
|
GLES20.glUniformMatrix4fv(projectionMatrixHandle, 1, false, projectionMatrix, 0);
|
||||||
GLES20.glUniform1f(pointSizeHandle, KEYPOINT_SIZE);
|
// GLES20.glUniform1f(pointSizeHandle, KEYPOINT_SIZE);
|
||||||
int numDetectedFaces = result.multiPoseTrackings().size();
|
// int numDetectedFaces = result.multiPoseTrackings().size();
|
||||||
for (int i = 0; i < numDetectedFaces; ++i) {
|
// for (int i = 0; i < numDetectedFaces; ++i) {
|
||||||
drawDetection(result.multiPoseTrackings().get(i));
|
// drawDetection(result.multiPoseTrackings().get(i));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,8 +99,11 @@ public class PoseTrackingResultGlRenderer implements ResultGlRenderer<PoseTracki
|
||||||
public void release() {
|
public void release() {
|
||||||
GLES20.glDeleteProgram(program);
|
GLES20.glDeleteProgram(program);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Not needed anymore, to be cleaned
|
||||||
|
* */
|
||||||
private void drawDetection(Detection detection) {
|
private void drawDetection(Detection detection) {
|
||||||
|
|
||||||
if (!detection.hasLocationData()) {
|
if (!detection.hasLocationData()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -106,28 +113,28 @@ public class PoseTrackingResultGlRenderer implements ResultGlRenderer<PoseTracki
|
||||||
// points[2 * i] = detection.getLocationData().getRelativeKeypoints(i).getX();
|
// points[2 * i] = detection.getLocationData().getRelativeKeypoints(i).getX();
|
||||||
// points[2 * i + 1] = detection.getLocationData().getRelativeKeypoints(i).getY();
|
// points[2 * i + 1] = detection.getLocationData().getRelativeKeypoints(i).getY();
|
||||||
// }
|
// }
|
||||||
GLES20.glUniform4fv(colorHandle, 1, KEYPOINT_COLOR, 0);
|
// GLES20.glUniform4fv(colorHandle, 1, KEYPOINT_COLOR, 0);
|
||||||
// FloatBuffer vertexBuffer =
|
// FloatBuffer vertexBuffer =
|
||||||
// ByteBuffer.allocateDirect(points.length * 4)
|
// ByteBuffer.allocateDirect(points.length * 4)
|
||||||
// .order(ByteOrder.nativeOrder())
|
// .order(ByteOrder.nativeOrder())
|
||||||
// .asFloatBuffer()
|
// .asFloatBuffer()
|
||||||
// .put(points);
|
// .put(points);
|
||||||
// vertexBuffer.position(0);
|
// vertexBuffer.position(0);
|
||||||
GLES20.glEnableVertexAttribArray(positionHandle);
|
// GLES20.glEnableVertexAttribArray(positionHandle);
|
||||||
// GLES20.glVertexAttribPointer(positionHandle, 2, GLES20.GL_FLOAT, false, 0, vertexBuffer);
|
// GLES20.glVertexAttribPointer(positionHandle, 2, GLES20.GL_FLOAT, false, 0, vertexBuffer);
|
||||||
// GLES20.glDrawArrays(GLES20.GL_POINTS, 0, FaceKeypoint.NUM_KEY_POINTS);
|
// GLES20.glDrawArrays(GLES20.GL_POINTS, 0, FaceKeypoint.NUM_KEY_POINTS);
|
||||||
if (!detection.getLocationData().hasRelativeBoundingBox()) {
|
if (!detection.getLocationData().hasRelativeBoundingBox()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Draw bounding box.
|
// Draw bounding box.
|
||||||
float left = detection.getLocationData().getRelativeBoundingBox().getXmin();
|
// float left = detection.getLocationData().getRelativeBoundingBox().getXmin();
|
||||||
float top = detection.getLocationData().getRelativeBoundingBox().getYmin();
|
// float top = detection.getLocationData().getRelativeBoundingBox().getYmin();
|
||||||
float right = left + detection.getLocationData().getRelativeBoundingBox().getWidth();
|
// float right = left + detection.getLocationData().getRelativeBoundingBox().getWidth();
|
||||||
float bottom = top + detection.getLocationData().getRelativeBoundingBox().getHeight();
|
// float bottom = top + detection.getLocationData().getRelativeBoundingBox().getHeight();
|
||||||
drawLine(top, left, top, right);
|
// drawLine(top, left, top, right);
|
||||||
drawLine(bottom, left, bottom, right);
|
// drawLine(bottom, left, bottom, right);
|
||||||
drawLine(top, left, bottom, left);
|
// drawLine(top, left, bottom, left);
|
||||||
drawLine(top, right, bottom, right);
|
// drawLine(top, right, bottom, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawLine(float y1, float x1, float y2, float x2) {
|
private void drawLine(float y1, float x1, float y2, float x2) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user