Browse Source

添加 Basler 相机的SDK封装类

master
sige 1 year ago
parent
commit
c4980557c9
  1. 134
      src/src/main/java/com/my/graphiteDigesterBg/diframe/component/baslerCamera/DiComBaslerCamera.java

134
src/src/main/java/com/my/graphiteDigesterBg/diframe/component/baslerCamera/DiComBaslerCamera.java

@ -0,0 +1,134 @@
package com.my.graphiteDigesterBg.diframe.component.baslerCamera;
public class DiComBaslerCamera {
public static final int ACCESS_MODE_MONITOR = 0;
public static final int ACCESS_MODE_CONTROL = 1;
public static final int ACCESS_MODE_STREAM = (1 << 1);
public static final int ACCESS_MODE_EVENT = (1 << 2);
public static final int ACCESS_MODE_EXCLUSIVE = (1 << 3);
public static class GrabResult {
public byte[] imageBuffer;
public int payloadType;
public int pixelType;
public int sizeX;
public int sizeY;
public int offsetX;
public int offsetY;
public int paddingX;
public int paddingY;
public long PayloadSize;
public int ErrorCode;
}
static {
System.load("D:/ProgramFiles/Pylon5/Runtime/x64/PylonC_v5_2.dll");
System.load("D:/Sige5193/graphite_digester_bg/src/src/main/java/com/my/graphiteDigesterBg/diframe/component/baslerCamera/x64/Debug/baslerCamera.dll");
}
/**
* Initializes the pylon runtime system.
*/
public native void initialize();
/**
* Enumerates all camera devices.
* @return The number of found devices.
*/
public native int enumerateDevices();
/**
* Terminates the pylon runtime system.
*/
public native void terminate();
/**
* Creates a camera device by index.
* @param index The index of the camera device.
* @return The handle of the camera device.
*/
public native long createDeviceByIndex(int index);
/**
* Opens the camera device.
* @param hDev The handle of the camera device.
* @param accessMode The access mode.
*/
public native void deviceOpen(long hDev, int accessMode);
/**
* Checks if a camera device feature is readable.
* @param hDev The handle of the camera device.
* @param name The name of the feature.
* @return true if the feature is readable, false otherwise.
*/
public native boolean deviceFeatureIsReadable(long hDev, String name);
/**
* Read a camera device feature to a string.
* @param hDev The handle of the camera device.
* @param name The name of the feature.
* @param size The size of the string buffer.
* @return The string value of the feature.
*/
public native String deviceFeatureToString(long hDev, String name, int size);
/**
* Checks if a camera device feature is available.
* @param hDev The handle of the camera device.
* @param name The name of the feature.
* @return true if the feature is available, false otherwise.
*/
public native boolean deviceFeatureIsAvailable(long hDev, String name);
/**
* Writes a camera device feature from a string.
* @param hDev The handle of the camera device.
* @param name The name of the feature.
* @param value The value of the feature.
*/
public native void deviceFeatureFromString(long hDev, String name, String value);
/**
* Checks if a camera device feature is writable.
* @param hDev The handle of the camera device.
* @param name The name of the feature.
* @return true if the feature is writable, false otherwise.
*/
public native boolean deviceFeatureIsWritable(long hDev, String name);
/**
* Writes a camera device feature from an integer.
* @param hDev The handle of the camera device.
* @param name The name of the feature.
* @param value The value of the feature.
*/
public native void deviceSetIntegerFeature(long hDev, String name, int value);
/**
* Reads a camera device feature to an integer.
* @param hDev The handle of the camera device.
* @param name The name of the feature.
* @return The integer value of the feature.
*/
public native int deviceGetIntegerFeatureInt32(long hDev, String name);
/**
* Grabs a single frame from the camera device.
* @param hDev The handle of the camera device.
* @param channel The channel index.
* @return The grab result.
*/
public native GrabResult deviceGrabSingleFrame(long hDev, int channel);
/**
* Closes the camera device.
* @param hDev The handle of the camera device.
*/
public native void deviceClose(long hDev);
/**
* Destroys the camera device.
* @param hDev The handle of the camera device.
*/
public native void destroyDevice(long hDev);
}
Loading…
Cancel
Save