This is a common issue since many cameras (including the Hamamatsu C8484-05C) do not return 16-bit data and so they do not send a frame that spans the full range of a 16-bit frame.
For example, if the camera's sensor is 12-bit, the frame data in a 16-bit mode can range as high as 2^16-1=65535 but the camera will only return 12-bit data which will be limited to 2^12-1=4095. Therefore, the maximum pixel value from the camera is 4095. However, the maximum value for the data type is 65535 and so the pixels appear black or dark blue.
If using MATLAB R2008b or later, a possible workaround is to use the following command before creating the videoinput object:
imaqmex('feature', '-previewFullBitDepth', true);
You can also configure the preview axes CDataMapping and CLim properties.
vid = videoinput('hamamatsu', 1);
h = preview(vid);
a = ancestor(h, 'axes');
set(h, 'CDataMapping', 'scaled');
returned by the camera.
set(a, 'CLim', [0 4095]);
Other approaches: * To preview the input from the camera, use the IMAQMONTAGE function. This function takes a snapshot of the video feed and displays the image in a MATLAB figure window. For example:
- After the videoinput object has been started and the GETDATA function has been used to move the data into the MATLAB workspace, scale the data (based on the bit depth of the camera). The resulting images should no longer look dark. You can lookup the bit depth of the camera in the camera manual or on the manufacturers web site. For example, to look up the bit-depth for the Hamamatsu camera in question, please refer to the following online resource:
A large number of cameras return 8, 10 or 12-bit mono data. In 8-bit mode the images returned would span the full range (the frame would consist of UINT8 data), however, 10-bit or 12-bit images would need to be scaled appropriately.