Image Data Buffer for ALP memory

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 Kommentare

Guillaume
Guillaume am 26 Feb. 2020
"How can i create a image data buffer or how does this looks like in this case?"
There is no standard image data buffer. If your library doesn't specify the binary format of the image, you're very much stuck.
"All pictures have to be connected to the same SequenceID. "
It's unclear what this means, particularly since SequenceID is never defined in the code you show.
Peer Blumido
Peer Blumido am 26 Feb. 2020
Ok, i understand.
The format (you mean Type? Readable for the hardware uint8) of the image is not the problem. The Problem is how can i transfer more than one image to the hardware memory.
The SequenceID is gerenated by the hardware. I created a pushbutton for the function AlpSeqPut where my picture is read and then loaded to the ALP Memory. My SequenceID is getting the number "1". When i press a second time the pushbutton, the SequenceID change to "2" with another picture i read and load and so on. In my case, i want for example in SequenceID = 1 not only one picture (one pointer to one picture) but more (one pointer to x pictures i selected). I Think this is how this DLL function works.
Do you know what i mean?
Guillaume
Guillaume am 26 Feb. 2020
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 am 27 Feb. 2020
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! :)

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Gefragt:

am 20 Feb. 2020

Kommentiert:

am 27 Feb. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by