Dear Community,
I am trying to acquire Hyperspectral Images from a EVK G2 Near Infrared Camera. I am using the gige connection and the image acquisition toolbox.
So far I managed to establish a connection between Matlab and the camera and to acquire an image from the camera. The issue is, I only get a 2D image in the dimensions of the working width and the number of lines the camera has taken.
I am stuck getting the third dimension which contains the actual spectral information I am trying to get. The dimension of the attained spectral cube should be 312xLinesx220 with 312 being the x Dimensionsion, Lines specifying the y dimension and 220 specifying the 220 discrete points distributed over the wavelength band.
%% Prepare Workspace
clc
clear all
close all
%% Use the gigecamlist function to ensure that MATLAB is discovering your camera.
gigecamlist
%% Create an object g
if exist('g','var') == 0
g = gigecam;
end
%% Adjust Packet Size to 1492
g.PacketSize = 1492;
%% Acquire One Image Frame from a GigE Camera
% Preview the image from the camera.
preview(g)
% Show for 1 Second
pause(10)
% Close the preview.
closePreview(g)
%% Acquire a single image from the camera using the snapshot function, and assign it to the variable img
img = snapshot(g);
% Display the acquired image.
imshow(img)
%% Create an image of 30s of recording
img = [] % Create empty image
user_input_time = 30; % Seconds
tic; % Start timer
while (toc < user_input_time) && (size(img,1) < 1000) % While loop runs for x seconds and as long as the image is less than 1000 rows high
img_curr = snapshot(g); % Take the image
img = [img; img_curr] % Append to the existing image
end
% Display the acquired image.
imshow(img)