I have a camera that has its own DLL library for passing parameters to the camera, and taking images. I am trying to make calls with this DLL library through python. I need to make a pointer for the raw image data, and i'm not exactly sure how to do this. The DLL has a function name and takes those parameters as inputs:
StTrg_TakeRawSnapShot(hCamera, pbyteraw, dwBufferSize, dwNumberOfByteTrans, dwFrameNo, dwMilliseconds)
hCamera:
This parameter sets the camera control handle that obtains by StTrg_Open.
pbyteRaw:
This parameter sets pointer of the raw image.
dwBufferSize:
This parameter sets the buffer size.
pdwNumberOfByteTrans:
This parameter sets the pointer that obtains the total number of the bytes of the image.
pdwFrameNo:
This parameter sets the pointer that obtains the frame number of the image that counts in the camera.
This number can be use for the frame drop detection.
dwMilliseconds:
This parameter sets the timeout time (Unit is msecond).
exactly as stated from the documentation of the camera, pbyteraw is: "This parameter sets pointer of the raw image" and that's all the detail they provide.
how do i create this raw image pointer, and then read it to a 2D array that i can work with in python? The camera is black and white, so i am hoping to get a 2D array of values between 0 and 255.
from ctypes import *
import numpy as np
mydll = windll.LoadLibrary('StTrgApi.dll')
hCamera = mydll.StTrg_Open()
im_height = 1600
im_width = 1200
dwBufferSize = im_height * im_width
pbyteraw = (c_ubyte * dwBufferSize)()
dwNumberOfByteTrans = 0
dwFrameNo = 0
dwMilliseconds = 3000
mydll.StTrg_TakeRawSnapShot(hCamera, pbyteraw, dwBufferSize,
dwNumberOfByteTrans, dwFrameNo, dwMilliseconds)
b_pbyte = bytearray(pbyteraw)