Image Data Buffer for ALP memory

1 回表示 (過去 30 日間)
Peer Blumido
Peer Blumido 2020 年 2 月 20 日
コメント済み: Peer Blumido 2020 年 2 月 27 日
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
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.
Peer Blumido
Peer Blumido 2020 年 2 月 27 日
Hey Guillaume,
the problem is solved. The image data buffer has not be a matrix, it has to be an array and it seems the hardware rebuild these rows to an image.
I have to seperate every row (1:1080) and put them to only one long row (1920*1080 = 2.073.600 values).
When i select multipe pictures my array increases to n*2.073.600.
Thanks for your help again! :)

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by