@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; } }
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; } }