本文整理汇总了Java中org.bytedeco.javacpp.Loader类的典型用法代码示例。如果您正苦于以下问题:Java Loader类的具体用法?Java Loader怎么用?Java Loader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Loader类属于org.bytedeco.javacpp包,在下文中一共展示了Loader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FaceDetectorAlpha
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
public FaceDetectorAlpha() {
this.file = new File (System.getProperty("user.home")+"/.webcamstudio/faces/haarcascade_frontalface_alt2.xml");
this.maskImg = (System.getProperty("user.home")+"/.webcamstudio/faces/Alien.png");
File sImg = new File(maskImg);
try {
sourceMask = ImageIO.read(sImg);
} catch (IOException ex) {
Logger.getLogger(FaceDetectorAlpha.class.getName()).log(Level.SEVERE, null, ex);
}
classifierName = file.getAbsolutePath();
Loader.load(opencv_objdetect.class);
this.classifier = new opencv_objdetect.CvHaarClassifierCascade(cvLoad(classifierName));
if (classifier.isNull()) {
System.err.println("Error loading classifier file \"" + classifierName + "\".");
System.exit(1);
}
}
示例2: tryLoad
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
public static void tryLoad() throws Exception {
if (loadingException != null) {
throw loadingException;
} else {
try {
Loader.load(org.bytedeco.javacpp.avutil.class);
Loader.load(org.bytedeco.javacpp.avcodec.class);
Loader.load(org.bytedeco.javacpp.avformat.class);
Loader.load(org.bytedeco.javacpp.postproc.class);
Loader.load(org.bytedeco.javacpp.swresample.class);
Loader.load(org.bytedeco.javacpp.swscale.class);
Loader.load(org.bytedeco.javacpp.avfilter.class);
av_register_all();
avfilter_register_all();
} catch (Throwable t) {
if (t instanceof Exception) {
throw loadingException = (Exception)t;
} else {
throw loadingException = new Exception("Failed to load " + FFmpegFrameRecorder.class, t);
}
}
}
}
示例3: tryLoad
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
public static void tryLoad() throws Exception {
if (loadingException != null) {
throw loadingException;
} else {
try {
Loader.load(org.bytedeco.javacpp.avutil.class);
Loader.load(org.bytedeco.javacpp.swresample.class);
Loader.load(org.bytedeco.javacpp.avcodec.class);
Loader.load(org.bytedeco.javacpp.avformat.class);
Loader.load(org.bytedeco.javacpp.swscale.class);
/* initialize libavcodec, and register all codecs and formats */
av_register_all();
avformat_network_init();
} catch (Throwable t) {
if (t instanceof Exception) {
throw loadingException = (Exception)t;
} else {
throw loadingException = new Exception("Failed to load " + FFmpegFrameRecorder.class, t);
}
}
}
}
示例4: imageChanged
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
@Override
public void imageChanged(IplImage image) {
// Allocate the memory storage TODO make this globalData
if (storage == null) {
storage = cvCreateMemStorage(0);
}
if (cascade == null) {
// Preload the opencv_objdetect module to work around a known bug.
Loader.load(opencv_objdetect.class);
cascade = new CvHaarClassifierCascade(cvLoad(String.format("%s/%s", cascadeDir, cascadeFile)));
// cascade = new
// CvHaarClassifierCascade(cvLoad("haarcascades/haarcascade_eye.xml"));
if (cascade == null) {
log.error("Could not load classifier cascade");
}
}
}
示例5: imageChanged
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
@Override
public void imageChanged(IplImage image) {
// Allocate the memory storage TODO make this globalData
if (storage == null) {
storage = cvCreateMemStorage(0);
}
if (cascade == null) {
// Preload the opencv_objdetect module to work around a known bug.
Loader.load(opencv_objdetect.class);
cascade = new CvHaarClassifierCascade(cvLoad(String.format("%s/%s", cascadeDir, cascadeFile)));
// cascade = new
// CvHaarClassifierCascade(cvLoad("haarcascades/haarcascade_eye.xml"));
if (cascade == null) {
log.error("Could not load classifier cascade");
}
}
}
示例6: imageChanged
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
@Override
public void imageChanged(IplImage image) {
// Allocate the memory storage TODO make this globalData
if (storage == null) {
storage = cvCreateMemStorage(0);
}
if (cascade == null) {
// Preload the opencv_objdetect module to work around a known bug.
Loader.load(opencv_objdetect.class);
log.info("Starting new classifier {}", cascadeFile);
cascade = new CvHaarClassifierCascade(cvLoad(String.format("%s/%s", cascadeDir, cascadeFile)));
// cascade = new
// CvHaarClassifierCascade(cvLoad("haarcascades/haarcascade_eye.xml"));
if (cascade == null) {
log.error("Could not load classifier cascade");
}
}
}
示例7: tryLoad
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
public static void tryLoad() throws Exception {
if (loadingException != null) {
throw loadingException;
} else {
try {
Loader.load(org.bytedeco.javacpp.avutil.class);
Loader.load(org.bytedeco.javacpp.avcodec.class);
Loader.load(org.bytedeco.javacpp.avformat.class);
Loader.load(org.bytedeco.javacpp.swscale.class);
} catch (Throwable t) {
if (t instanceof Exception) {
throw loadingException = (Exception)t;
} else {
throw loadingException = new Exception("Failed to load " + FFmpegFrameRecorder.class, t);
}
}
}
}
示例8: tryLoad
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
public static void tryLoad() throws Exception {
if (loadingException != null) {
throw loadingException;
} else {
try {
Loader.load(org.bytedeco.javacpp.avutil.class);
Loader.load(org.bytedeco.javacpp.avcodec.class);
Loader.load(org.bytedeco.javacpp.avformat.class);
Loader.load(org.bytedeco.javacpp.avdevice.class);
Loader.load(org.bytedeco.javacpp.swscale.class);
} catch (Throwable t) {
if (t instanceof Exception) {
throw loadingException = (Exception)t;
} else {
throw loadingException = new Exception("Failed to load " + FFmpegFrameGrabber.class, t);
}
}
}
}
示例9: FaceView
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
public FaceView(FacePreview context) throws IOException {
super(context);
// Load the classifier file from Java resources.
File classifierFile = Loader.extractResource(getClass(),
"/org/bytedeco/javacv/facepreview/haarcascade_frontalface_alt.xml",
context.getCacheDir(), "classifier", ".xml");
if (classifierFile == null || classifierFile.length() <= 0) {
throw new IOException("Could not extract the classifier file from Java resource.");
}
// Preload the opencv_objdetect module to work around a known bug.
Loader.load(opencv_objdetect.class);
classifier = new CvHaarClassifierCascade(cvLoad(classifierFile.getAbsolutePath()));
classifierFile.delete();
if (classifier.isNull()) {
throw new IOException("Could not load the classifier file.");
}
storage = CvMemStorage.create();
}
示例10: init
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
@Override public void init() {
try {
// Load the classifier file from Java resources.
String classiferName = "haarcascade_frontalface_alt.xml";
File classifierFile = Loader.extractResource(classiferName, null, "classifier", ".xml");
if (classifierFile == null || classifierFile.length() <= 0) {
throw new IOException("Could not extract \"" + classiferName + "\" from Java resources.");
}
// Preload the opencv_objdetect module to work around a known bug.
Loader.load(opencv_objdetect.class);
classifier = new CvHaarClassifierCascade(cvLoad(classifierFile.getAbsolutePath()));
classifierFile.delete();
if (classifier.isNull()) {
throw new IOException("Could not load the classifier file.");
}
storage = CvMemStorage.create();
} catch (Exception e) {
if (exception == null) {
exception = e;
repaint();
}
}
}
示例11: Nd4jBlas
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
public Nd4jBlas() {
int numThreads;
String skipper = System.getenv("ND4J_SKIP_BLAS_THREADS");
if (skipper == null || skipper.isEmpty()) {
String numThreadsString = System.getenv("OMP_NUM_THREADS");
if (numThreadsString != null && !numThreadsString.isEmpty()) {
numThreads = Integer.parseInt(numThreadsString);
setMaxThreads(numThreads);
} else {
int cores = Loader.totalCores();
int chips = Loader.totalChips();
if (cores > 0 && chips > 0)
numThreads = Math.max(1, cores / chips);
else
numThreads = NativeOps.getCores(Runtime.getRuntime().availableProcessors());
setMaxThreads(numThreads);
}
log.info("Number of threads used for BLAS: {}", getMaxThreads());
}
}
示例12: setClassifier
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
public void setClassifier(String name) {
try {
setClassiferName(name);
classifierFile = Loader.extractResource(classiferName, null, "classifier", ".xml");
if (classifierFile == null || classifierFile.length() <= 0) {
throw new IOException("Could not extract \"" + classiferName + "\" from Java resources.");
}
// Preload the opencv_objdetect module to work around a known bug.
Loader.load(opencv_objdetect.class);
classifier = new CvHaarClassifierCascade(cvLoad(classifierFile.getAbsolutePath()));
classifierFile.delete();
if (classifier.isNull()) {
throw new IOException("Could not load the classifier file.");
}
} catch (Exception e) {
if (exception == null) {
exception = e;
}
}
}
示例13: setClassifierEye
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
public void setClassifierEye(String name) {
try {
classiferName = name;
classifierFile = Loader.extractResource(classiferName, null, "classifier", ".xml");
if (classifierFile == null || classifierFile.length() <= 0) {
throw new IOException("Could not extract \"" + classiferName + "\" from Java resources.");
}
// Preload the opencv_objdetect module to work around a known bug.
Loader.load(opencv_objdetect.class);
classifierEye = new CvHaarClassifierCascade(cvLoad(classifierFile.getAbsolutePath()));
classifierFile.delete();
if (classifier.isNull()) {
throw new IOException("Could not load the classifier file.");
}
} catch (Exception e) {
if (exception == null) {
exception = e;
}
}
}
示例14: setClassifierSmile
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
public void setClassifierSmile(String name) {
try {
setClassiferName(name);
classifierFile = Loader.extractResource(classiferName, null, "classifier", ".xml");
if (classifierFile == null || classifierFile.length() <= 0) {
throw new IOException("Could not extract \"" + classiferName + "\" from Java resources.");
}
// Preload the opencv_objdetect module to work around a known bug.
Loader.load(opencv_objdetect.class);
classifierSmile = new CvHaarClassifierCascade(cvLoad(classifierFile.getAbsolutePath()));
classifierFile.delete();
if (classifier.isNull()) {
throw new IOException("Could not load the classifier file.");
}
} catch (Exception e) {
if (exception == null) {
exception = e;
}
}
}
示例15: setClassifierSideFace
import org.bytedeco.javacpp.Loader; //导入依赖的package包/类
public void setClassifierSideFace(String name) {
try {
classiferName = name;
classifierFile = Loader.extractResource(classiferName, null, "classifier", ".xml");
if (classifierFile == null || classifierFile.length() <= 0) {
throw new IOException("Could not extract \"" + classiferName + "\" from Java resources.");
}
// Preload the opencv_objdetect module to work around a known bug.
Loader.load(opencv_objdetect.class);
classifierSideFace = new CvHaarClassifierCascade(cvLoad(classifierFile.getAbsolutePath()));
classifierFile.delete();
if (classifier.isNull()) {
throw new IOException("Could not load the classifier file.");
}
} catch (Exception e) {
if (exception == null) {
exception = e;
}
}
}