Search in sources :

Example 1 with CvException

use of org.opencv.core.CvException in project Frankenstein by olir.

the class ProcessingSceneController method initProcessing.

public void initProcessing(ConfigurationSceneController cController, Configuration configuration) {
    markPosition = -1;
    taskPosition = -1;
    selectedFilter = null;
    filterListData.clear();
    this.taskMessage = "";
    this.taskErrorMessage = null;
    processor = new MovieProcessor(configuration);
    try {
        processor.init(ProcessingSceneController.this);
        Platform.runLater(() -> {
            drawEditCanvas();
            startButton.setDisable(false);
            btnMark.setDisable(false);
            btnOneFrame.setDisable(true);
            btnClear.setDisable(true);
            // btnCopy.setDisable(true);
            // btnPaste.setDisable(true);
            btnListAdd.setDisable(true);
            btnListFilter.setDisable(true);
            btnListDelete.setDisable(true);
            currentTime.setDisable(false);
            currentFrameIndex.setDisable(false);
        });
    } catch (CvException e) {
        taskError(e.toString());
    }
}
Also used : MovieProcessor(de.serviceflow.frankenstein.MovieProcessor) CvException(org.opencv.core.CvException)

Example 2 with CvException

use of org.opencv.core.CvException in project Relic_Main by TeamOverdrive.

the class Utils method exportResource.

public static String exportResource(Context context, int resourceId, String dirname) {
    String fullname = context.getResources().getString(resourceId);
    String resName = fullname.substring(fullname.lastIndexOf("/") + 1);
    try {
        InputStream is = context.getResources().openRawResource(resourceId);
        File resDir = context.getDir(dirname, Context.MODE_PRIVATE);
        File resFile = new File(resDir, resName);
        FileOutputStream os = new FileOutputStream(resFile);
        byte[] buffer = new byte[4096];
        int bytesRead;
        while ((bytesRead = is.read(buffer)) != -1) {
            os.write(buffer, 0, bytesRead);
        }
        is.close();
        os.close();
        return resFile.getAbsolutePath();
    } catch (IOException e) {
        e.printStackTrace();
        throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e);
    }
}
Also used : InputStream(java.io.InputStream) FileOutputStream(java.io.FileOutputStream) CvException(org.opencv.core.CvException) IOException(java.io.IOException) File(java.io.File)

Aggregations

CvException (org.opencv.core.CvException)2 MovieProcessor (de.serviceflow.frankenstein.MovieProcessor)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1