@Nullable public Face[] getRecognizedFaces() { byte[] bytes = getByteArray(TAG_FACE_RECOGNITION_INFO); if (bytes == null) return null; RandomAccessReader reader = new ByteArrayReader(bytes); reader.setMotorolaByteOrder(false); try { int faceCount = reader.getUInt16(0); if (faceCount==0) return null; Face[] faces = new Face[faceCount]; for (int i = 0; i < faceCount; i++) { int offset = 4 + i * 44; String name = reader.getString(offset, 20, "ASCII").trim(); String age = reader.getString(offset + 28, 20, "ASCII").trim(); faces[i] = new Face( reader.getUInt16(offset + 20), reader.getUInt16(offset + 22), reader.getUInt16(offset + 24), reader.getUInt16(offset + 26), name, Age.fromPanasonicString(age)); } return faces; } catch (IOException e) { return null; } }
@Nullable private String buildFacesDescription(@Nullable Face[] faces) { if (faces == null) return null; StringBuilder result = new StringBuilder(); for (int i = 0; i < faces.length; i++) result.append("Face ").append(i + 1).append(": ").append(faces[i].toString()).append("\n"); return result.length() > 0 ? result.substring(0, result.length() - 1) : null; }
Face top=new Face(); Face bottom=new Face(); Face north=new Face(); Face south=new Face(); Face east=new Face(); Face west=new Face(); north.addVertex(hll); north.addVertex(hhl); north.addVertex(hhh); north.addVertex(hlh); north.rewind(centre); south.addVertex(lll); south.addVertex(lhl); south.addVertex(lhh); south.addVertex(llh); south.rewind(centre); top.addVertex(hhh); top.addVertex(hhl); top.addVertex(lhl); top.addVertex(lhh); top.rewind(centre); bottom.addVertex(hlh); bottom.addVertex(hll); bottom.addVertex(lll); bottom.addVertex(llh);
@Nullable public Face[] getDetectedFaces() { byte[] bytes = getByteArray(TAG_FACE_DETECTION_INFO); if (bytes==null) return null; RandomAccessReader reader = new ByteArrayReader(bytes); reader.setMotorolaByteOrder(false); try { int faceCount = reader.getUInt16(0); if (faceCount==0) return null; Face[] faces = new Face[faceCount]; for (int i = 0; i < faceCount; i++) { int offset = 2 + i * 8; faces[i] = new Face( reader.getUInt16(offset), reader.getUInt16(offset + 2), reader.getUInt16(offset + 4), reader.getUInt16(offset + 6) , null, null); } return faces; } catch (IOException e) { return null; } }
@Nullable private String buildFacesDescription(@Nullable Face[] faces) { if (faces == null) return null; StringBuilder result = new StringBuilder(); for (int i = 0; i < faces.length; i++) result.append("Face ").append(i + 1).append(": ").append(faces[i].toString()).append("\n"); return result.length() > 0 ? result.substring(0, result.length() - 1) : null; }
class FaceFrame extends JFrame { private Face face; public FaceFrame() { super(); this.face = new Face(); } public Face getFace() { return face; } }
public final class DieUtill { public static final Die COIN = new Die(new Face[] {new Face("head"),new Face("tail")}); public static final Die DICE = new Die(new Face[] {new Face("1"),new Face("2"),new Face("3"),new Face("4"),new Face("5"),new Face("5")}); public static final Face getRandomFace(Die die) { int face = new Random().nextInt(die.getFaceCount()); return die.getFace(face); } }
frame.setTitle("A Rectangle Object in a JFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Face face = new Face(); frame.add(face); frame.setVisible(true);
Face face = new Face(); faces.add(face);
Face f = new Face(); String[] faceVertexArray = line.split(" ");
Face f = new Face(); String[] faceVertexArray = line.split(" ");
@Nullable public Face[] getRecognizedFaces() { byte[] bytes = getByteArray(TAG_FACE_RECOGNITION_INFO); if (bytes == null) return null; RandomAccessReader reader = new ByteArrayReader(bytes); reader.setMotorolaByteOrder(false); try { int faceCount = reader.getUInt16(0); if (faceCount==0) return null; Face[] faces = new Face[faceCount]; for (int i = 0; i < faceCount; i++) { int offset = 4 + i * 44; String name = reader.getString(offset, 20, "ASCII").trim(); String age = reader.getString(offset + 28, 20, "ASCII").trim(); faces[i] = new Face( reader.getUInt16(offset + 20), reader.getUInt16(offset + 22), reader.getUInt16(offset + 24), reader.getUInt16(offset + 26), name, Age.fromPanasonicString(age)); } return faces; } catch (IOException e) { return null; } }
@Nullable public Face[] getDetectedFaces() { byte[] bytes = getByteArray(TAG_FACE_DETECTION_INFO); if (bytes==null) return null; RandomAccessReader reader = new ByteArrayReader(bytes); reader.setMotorolaByteOrder(false); try { int faceCount = reader.getUInt16(0); if (faceCount==0) return null; Face[] faces = new Face[faceCount]; for (int i = 0; i < faceCount; i++) { int offset = 2 + i * 8; faces[i] = new Face( reader.getUInt16(offset), reader.getUInt16(offset + 2), reader.getUInt16(offset + 4), reader.getUInt16(offset + 6) , null, null); } return faces; } catch (IOException e) { return null; } }