-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
This wiki page offers a tutorial on how to use the code with the MATLAB wrapper. Usage with other wrappers is similar.
- Configuration of the LightCrafter DLP900 GUI
- Description of how we did our experiments and synchronized the PLM with the camera
- Documentation of each function in the library
- Description of our LabVIEW implementation
Similar to LCOS-SLMs, when connected, the PLM appears in the operating system as a second monitor screen with a resolution of 2716 x 1600. Through HDMI, the virtual monitor screen updates at 30 Hz, and through DisplayPort, at 60 Hz.
The hologram rates of 720 Hz or 1440 Hz come from the fact that in each 2716 x 1600 RGB frame sent to the screen, we can encode 24 different PLM holograms to set a 4-bit height matrix of 1358 x 800.
Before sending the RGB frames to the PLM screen, it is necessary to convert the 1358 x 800 4-bit height profile of the PLM into a 2716 x 1600 binary hologram.
Each pixel of the PLM's 2716 x 1600 virtual monitor can store an RGB color. Each color has an 8-bit depth, so each pixel can hold 24 bits of data.
Each pixel of the 1358 x 800 4-bit phase values is spatially encoded into a 2x2 pattern. This means that a full hologram of the PLM is a (2 * 1358 x 2 * 800) binary pattern. Each of these 2716 x 1600 binary patterns can be placed into the bits of the RGB colors by bit-packing.
MAX_FRAMES = 4;
% Set monitor size
N = 1358; % PLM width
M = 800; % PLM height
plm = PLMController(MAX_FRAMES, N, M);
plm
now hold a struct that contains methods we can call to change what's displayed to the PLM.
MAX_FRAMES
is an argument of the StartUI
function to set the number of frames to store in the library's memory. In this case, you're limited by how much free RAM your PC has available. Each frame can store up to 24 holograms and takes ~15.5 MiB of memory. It's 25% more than what's actually necessary (~12.4 MiB) because the texture is in RGBA format due to DirectX being happy only with the R8G8B8A8 format, which fits nicely in 32 bits (4 bytes), instead of R8G8B8 (24 bits, 3 bytes).
When the second monitor is already recognized by the operating system, StartUI
will render a full-screen texture in second monitor
% This function now requires a monitor_id for chosing the second monitor
monitor_id = 1; % Currently not working. It's currently hardcoded to display in the second monitor
plm.StartUI(monitor_id);
monitor_id
is a variable to select in which monitor to display the full-screen texture. monitor_id = 0
is your main monitor. It follows the order configured on your OS's display settings.
Now let's say you have one single normalized phase profile that you want to convert to a PLM hologram, the function BitpackHolograms
does that for you
phase = zeros(N, M);
frame = plm.BitpackHolograms(phase);
After calling BitpackHolograms
, frame
contains the phase hologram in the lowest bit of the Red channel. frame
is a 4*(2*N)
by 2*M
matrix. The 4
there is because it's a RGBA texture. The alpha channel will be always set to 255 if the hologram is generated with BitpackHolograms
. PLM will discard the alpha channel.
Multiple phase profiles can be encoded in the same frame as such
numHolograms = 24;
phase = zeros(N, M, numHolograms);
frames = plm.BitpackHolograms(phase);
Now, frames
contains each hologram for each page of the phase
matrix in the bits of the RGB channels. The holograms are placed in Red-Green-Blue order, from the least significant bit to the highest (little endian). With the Port Swap ABC->ABC enabled, this will be the actual order of display too.
This bitpacked frame
can be sent to the plmctrl
memory space by using InsertFrame
% Uploads 1 frame (contains 24 holograms) to the PLM sequence
offset = 0;
plm.InsertFrame(frame, offset);
Now the holograms are in plmctrl
's memory space and can be set to display in any order.
Now that the frame
is in plmctrl
's memory space, you can display it statically using SetFrame
.
offset = 0;
plm.SetFrame(offset);
sequence = [0,1,2,3];
plm.SetFrameSequence(sequence);
frames_to_display = 4;
plm.StartSequence(frames_to_display);
...