Ask Your Question
0

Hi! i am trying to take and save a snapshot using java. How to remove the error generated as below:

asked 2018-05-29 05:15:35 -0600

nikshita gravatar image

updated 2018-05-29 05:16:24 -0600

error : OpenCV(3.4.1) Error: Unspecified error (could not find a writer for the specified extension) in cv::imwrite_, file C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\imgcodecs\src\loadsave.cpp, line 678

Snapshot button code : int returnVal = jFileChooser1.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = jFileChooser1.getSelectedFile(); Imgcodecs.imwrite(file.getPath(), frame); } else { System.out.println("File access cancelled by user.");

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-05-29 05:21:19 -0600

berak gravatar image

you need to call imwrite() with a filename and an extension (so it can infer the type), like this:

 imwrite("my.png", img);
edit flag offensive delete link more

Comments

note, that it won't support .gif !

berak gravatar imageberak ( 2018-05-29 05:22:25 -0600 )edit

Thanks you. my error is resolved.

nikshita gravatar imagenikshita ( 2018-05-29 23:06:20 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-05-29 05:15:35 -0600

Seen: 591 times

Last updated: May 29 '18