MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / mark

Method mark

src/com/cloudream/ishow/algorithm/FaceDetector.java:253–347  ·  view source on GitHub ↗

@brief mark image with feature points, along with it's order. @param image the image to be marked. @param points feature points found by #detectFaceSingle. @return marked image, mostly used for debugging.

(Bitmap image, PointF points[])

Source from the content-addressed store, hash-verified

251 * @return marked image, mostly used for debugging.
252 */
253 public static Bitmap mark(Bitmap image, PointF points[])
254 {
255 if(points == null)
256 return image;
257
258 Bitmap mutableBitmap = image.copy(Bitmap.Config.ARGB_8888, true);
259 Canvas canvas = new Canvas(mutableBitmap);
260
261 Paint paint = new Paint();
262 paint.setAntiAlias(true);
263 paint.setDither(true);
264 paint.setStyle(Paint.Style.STROKE);
265 paint.setStrokeJoin(Paint.Join.ROUND);
266 paint.setStrokeCap(Paint.Cap.ROUND);
267// paint.setStrokeWidth(1);
268
269// canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); // clear
270// paint.setColor(Color.TRANSPARENT);
271// canvas.drawRect(0, 0, bmp_raw.getWidth(), bmp_raw.getHeight(), paint);
272 paint.setColor(Color.GREEN);
273 final float radius = 1;
274 for(int i = 0; i < points.length; ++i)
275 {
276 final PointF point = points[i];
277// canvas.drawCircle(point.x, point.y, radius, paint);
278 canvas.drawPoint(point.x, point.y, paint);
279 canvas.drawText(String.valueOf(i), point.x + radius, point.y, paint);
280 }
281
282 paint.setStyle(Style.STROKE);
283 Path path_face = getClosedPath(points, 0, 19);
284 Path path_eye_brow_r = getEyeBrowPath(points, 22, 21, 20 ,25, 24 ,23);
285 Path path_eye_brow_l = getEyeBrowPath(points, 29, 28, 27, 26, 31, 30);
286 Path path_eye_r = getClosedPath(points, 34, 41);
287 Path path_eye_l = getClosedPath(points, 44, 51);
288 Path path_upper_lip = getUpperLip(points);
289 Path path_lower_lip = getLowerLip(points);
290
291 paint.setColor(Color.BLUE);
292 canvas.drawPath(path_face, paint);
293 canvas.drawPath(path_eye_brow_r, paint);
294 canvas.drawPath(path_eye_brow_l, paint);
295 canvas.drawPath(path_eye_r, paint);
296 canvas.drawPath(path_eye_l, paint);
297 canvas.drawPath(path_upper_lip, paint);
298 canvas.drawPath(path_lower_lip, paint);
299
300 Path path_lip = new Path();
301 path_lip.addPath(path_upper_lip);
302 path_lip.addPath(path_lower_lip);
303// Region region = new Region();
304// region.setPath(path_lip, null);
305
306 // iris
307 float iris_r_radius = 0, iris_l_radius = 0;
308 final int iris_indices_r[] = {35, 37, 39, 41};
309 final int iris_indices_l[] = {45, 47, 49, 51};
310 if(false)

Callers 1

onCheckedChangedMethod · 0.95

Calls 6

getClosedPathMethod · 0.95
getEyeBrowPathMethod · 0.95
getUpperLipMethod · 0.95
getLowerLipMethod · 0.95
distanceMethod · 0.95
getNosePathMethod · 0.95

Tested by

no test coverage detected