这是我的btnCapture ActionPerformed:
FileDialog fd = new FileDialog(cam.this, "Save Image", FileDialog.SAVE);
fd.show();
if (fd.getFile() != null) {
fn = fd.getDirectory() + fd.getFile() + ".jpg";
try {
Imgcodecs.imwrite(fn, frame);
} catch (Exception ex) {}
}