• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java BytePointer类的典型用法和代码示例

java 10次浏览

本文整理汇总了Java中org.bytedeco.javacpp.BytePointer的典型用法代码示例。如果您正苦于以下问题:Java BytePointer类的具体用法?Java BytePointer怎么用?Java BytePointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

BytePointer类属于org.bytedeco.javacpp包,在下文中一共展示了BytePointer类的38个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCaptchInString

点赞 3

import org.bytedeco.javacpp.BytePointer; //导入依赖的package包/类
public String getCaptchInString(String fileName )  {
	BytePointer outText;

    TessBaseAPI api = new TessBaseAPI();
    // Initialize tesseract-ocr with English, without specifying tessdata path
    if (api.Init(".", "ENG") != 0) {
        System.err.println("Could not initialize tesseract.");
        System.exit(1);
    }

    // Open input image with leptonica library
    PIX image = pixRead(fileName);
    api.SetImage(image);
    // Get OCR result
    outText = api.GetUTF8Text();
    String captchaInString = outText.getString();
    System.out.println("OCR output: " + captchaInString);

    // Destroy used object and release memory
    api.End();
    outText.deallocate();
    pixDestroy(image);
    api.close();
    return captchaInString.replaceAll("\\s+","");
}
 

开发者ID:M-Thirumal,
项目名称:DecodeCaptcha,
代码行数:26,
代码来源:DecodeCaptcha.java

示例2: FrameExperienceMemory

点赞 3

import org.bytedeco.javacpp.BytePointer; //导入依赖的package包/类
public FrameExperienceMemory(int size, int maxHistoryLength, PreProcessor preProcessor, ActionSet actionSet, boolean alwaysIncludeMostRecent) {
    if(size < 1){
        throw new RuntimeException("FixedSizeMemory requires memory size > 0; was request size of " + size);
    }
    this.alwaysIncludeMostRecent = alwaysIncludeMostRecent;
    this.experiences = new FrameExperience[size];

    this.currentFrameHistory = new FrameHistory(0, 0);
    this.maxHistoryLength = maxHistoryLength;

    this.preProcessor = preProcessor;
    this.actionSet = actionSet;

    long outputSize = preProcessor.outputSize();

    // Create the frame history data size to be totalHistorySize + a padding on both sides of n - 1
    long paddingSize = (this.maxHistoryLength - 1) * outputSize;
    frameMemory = (new BytePointer(size * outputSize + 2 * paddingSize)).zero();
}
 

开发者ID:h2r,
项目名称:burlap_caffe,
代码行数:20,
代码来源:FrameExperienceMemory.java

示例3: readScreenMatrix

点赞 3

import org.bytedeco.javacpp.BytePointer; //导入依赖的package包/类
/** Reads the edu.brown.cs.burlap.screen matrix update from a string. The string only contains the
 *   pixels that differ from the previous frame.
 *
 * @param line The edu.brown.cs.burlap.screen part of the string sent by ALE.
 */
protected void readScreenMatrix(String line, Mat frame) {
    BytePointer screenData = frame.data();
    int position = 0;

    byte[] buffer = new byte[frame.rows() * frame.cols() * frame.channels()];

    int ptr = 0;

    // 0.3 protocol - send everything
    for (int y = 0; y < frame.rows(); y++)
        for (int x = 0; x < frame.cols(); x++) {
            int v = byteAt(line, ptr);

            Color c = colorPalette.get(v);
            buffer[position] = (byte)c.getBlue();
            buffer[position + 1] = (byte)c.getGreen();
            buffer[position + 2] = (byte)c.getRed();

            position += 3;

            ptr += 2;
        }

    screenData.put(buffer);
}
 

开发者ID:h2r,
项目名称:burlap_ale,
代码行数:31,
代码来源:ALEDriver.java

示例4: imageChanged

点赞 3

import org.bytedeco.javacpp.BytePointer; //导入依赖的package包/类
@Override
public void imageChanged(IplImage image) {

	eig = IplImage.create(imageSize, IPL_DEPTH_32F, 1);
	tmp = IplImage.create(imageSize, IPL_DEPTH_32F, 1);

	imgB = IplImage.create(imageSize, 8, 1);
	imgA = IplImage.create(imageSize, 8, 1);

	if (channels == 3) {
		cvCvtColor(image, imgB, CV_BGR2GRAY);
		cvCopy(imgB, imgA);
	}

	cornersA = new CvPoint2D32f(maxPointCount);
	cornersB = new CvPoint2D32f(maxPointCount);
	cornersC = new CvPoint2D32f(maxPointCount);

	// Call Lucas Kanade algorithm
	features_found = new BytePointer(maxPointCount);
	feature_errors = new FloatPointer(maxPointCount);

}
 

开发者ID:glaudiston,
项目名称:project-bianca,
代码行数:24,
代码来源:OpenCVFilterLKOpticalTrack.java

示例5: imageChanged

点赞 3

import org.bytedeco.javacpp.BytePointer; //导入依赖的package包/类
@Override
public void imageChanged(IplImage image) {

  eig = IplImage.create(imageSize, IPL_DEPTH_32F, 1);
  tmp = IplImage.create(imageSize, IPL_DEPTH_32F, 1);

  imgB = IplImage.create(imageSize, 8, 1);
  imgA = IplImage.create(imageSize, 8, 1);

  if (channels == 3) {
    cvCvtColor(image, imgB, CV_BGR2GRAY);
    cvCopy(imgB, imgA);
  }

  cornersA = new CvPoint2D32f(maxPointCount);
  cornersB = new CvPoint2D32f(maxPointCount);
  cornersC = new CvPoint2D32f(maxPointCount);

  // Call Lucas Kanade algorithm
  features_found = new BytePointer(maxPointCount);
  feature_errors = new FloatPointer(maxPointCount);

}
 

开发者ID:MyRobotLab,
项目名称:myrobotlab,
代码行数:24,
代码来源:OpenCVFilterLKOpticalTrack.java

示例6: call

点赞 3

import org.bytedeco.javacpp.BytePointer; //导入依赖的package包/类
@Override public int call(int status, BytePointer func_name, BytePointer err_msg,
        BytePointer file_name, int line, Pointer userdata) {
    final String title = "OpenCV Error";
    final String message = cvErrorStr(status) +
            " (" + err_msg.getString() + ")\nin function " +
            func_name.getString() + ", " + file_name.getString() + "(" + line + ")";
    Logger.getLogger(JavaCvErrorCallback.class.getName()).log(Level.SEVERE,
            title + ": " + message, new java.lang.Exception("Strack trace"));
    if (showDialog) {
        // Show no more than 1 dialog per second since we cannot stop OpenCV
        // from processing and throwing more errors. Maybe in the future
        // when JavaCPP allows us to throw Exceptions across...
        if (System.currentTimeMillis() - lastErrorTime > 1000) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    JOptionPane.showMessageDialog(parent, message,
                            title, JOptionPane.ERROR_MESSAGE);
                }
            });
        }
        lastErrorTime = System.currentTimeMillis();
    }
    return rc; // 0 = please don't terminate
}
 

开发者ID:duodecimo,
项目名称:jmcv,
代码行数:25,
代码来源:JavaCvErrorCallback.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)