Image Data Buffer for ALP memory
1 次查看(过去 30 天)
显示 更早的评论
Hello,
i'm trying to find a solution to load multiple pictures into the memory of a Digital Micromirror Device.
% This works fine for only one picture
PicOffset = int32(0);
PicLoad = int32(0); % Change for number of pictures, pic = 1 -> int32(0)
assignin('base','PicOffset',PicOffset);
assignin('base','PicLoad',PicLoad);
pic = imread('test.jpg'); % Picture
pic = rgb2gray(pic);
pic = fliplr(pic);
imwrite(pic,'pic.png');
UserArray = uint8(pic); % UserArray for memory
UserArrayPtr = libpointer('voidPtr',UserArray); % Pointer for UserArray
[STATUS_ALP_SEQ_PUT, ~] = calllib('alp4395','AlpSeqPut', ALP_ID, SequenceID, PicOffset, PicLoad, UserArrayPtr); % UserArray will be loaded into memory
I tried to execute the DLL function multiple times for different pictures but this didnt work. All pictures have to be connected to the same SequenceID.
All what i've got about this function is "UserArrayPtr - pointer to the user data to be loaded" and "pointer to a readable image data buffer".
How can i create a image data buffer or how does this looks like in this case?
Thanks a lot for any suggestions!
4 个评论
Guillaume
2020-2-26
By format I meant memory layout, e.g. it could be row or column major, if the type is more than 8-bit (yours isn't it looks like) it could be little or big endian, if there's more than one colour channel, they could be interlaced or plane by plane, or you could even have one of the many bayer encoding. Some 12-bit monochrome camera sensors pack 4 pixels in 3 bytes, etc. Each device has its own way of storing the image pixels.
However, it doesn't sound that it's what you're after. But similarly, the C library documentation should specify how the image sequence should be stored and what you need to pass to the function. Possibly, you just put all the images one after the other in memory and pass a pointer to the first image as well as an image count. This should be documented by your library.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing and Computer Vision 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!