public void update(Document document) {
		Element camImage = (Element) document.getElementsByTagName("CamImage")
				.item(0);
		if (camImage != null) {
			int width = Integer.parseInt(camImage.getAttribute("width"));
			int height = Integer.parseInt(camImage.getAttribute("height"));
			int frame = Integer.parseInt(camImage.getAttribute("frame"));
			int length = Integer.parseInt(camImage.getAttribute("length"));
			String data = camImage.getTextContent();
			// bufferdimage を初期化
			if (cameraImage == null || cameraImage.getWidth() != width
					|| cameraImage.getHeight() != height)
				init(width, height);
			// base64 展開
			byte[] decoded = new byte[length];
			VisionFrame.inflateWithBase64(data, decoded);
			int[] pixels = ((DataBufferInt) cameraImage.getRaster()
					.getDataBuffer()).getData();
			if (controlPanel.rgbPreview)
				yvu2rgb(decoded, pixels);
			else
				yvu2yvu(decoded, pixels);

			// パネルを再描画
			imagePanel.repaint();
			if (controlPanel.isCapture) {
				try {
					File dir = new File("snapshot");
					if (!dir.exists()) {
						dir.mkdir();
					}
					OutputStream os = new FileOutputStream("snapshot/image"
							+ frame + ".ppm");
					os.write("P6\n".getBytes());
					os.write((width + " " + height + "\n").getBytes());
					os.write("255\n".getBytes());
					os.write(decoded, 0, length);
					os.close();
				} catch (FileNotFoundException e) {
					e.printStackTrace();
				} catch (IOException e) {
					e.printStackTrace();
				}
				controlPanel.isCapture = false;
				controlPanel.capButton.setEnabled(true);
			}
		}
	}