musall / WidefieldImager

Pre-processing pipeline for widefield data
6 stars 9 forks source link

Trouble connecting with Matrix adaptor #2

Open thomasmichaelkane opened 3 months ago

thomasmichaelkane commented 3 months ago

Hi

I believe I have followed the instructions correctly. I am using a matrox adaptor frame grabber, which I can identify:

    >> imaqhwinfo

    ans =

      struct with fields:

        InstalledAdaptors: {'matrox'}
            MATLABVersion: '23.2 (R2023b)'
              ToolboxName: 'Image Acquisition Toolbox'
           ToolboxVersion: '23.2 (R2023b)'

and use:

    m = videoinput('matrox', 1, 'C:\Users\admin\Downloads\MV-D1024E-160-CL-12_1024x1024_2Tap12bitCon.dcf');

and is also found initially by WidefieldImager:

    >> WidefieldImager
    No NI devices found or data acquisition toolbox missing.
    Use software triggers instead.
    PCO camera not available. Searching for other cameras.
    Using matrox as current video adapter

However, it also then shows a warning stating that the camera cannot be found. I'm not sure how to navigate this problem. Do you have any ideas whats going wrong?

    Warning: No camera found. Type "imaqhwinfo" to make sure your camera is porperly installed and running.
    > In WidefieldImager>WidefieldImager_OpeningFcn (line 110)
    In gui_mainfcn (line 220)
    In WidefieldImager (line 42)
musall commented 3 months ago

Hi Thomas,

that is indeed surprising. I assume that something goes wrong in the 'checkCamera' function which is used to set up some of the camera settings. If this function fails, it returns an empty video object which would explain your problem. It is probably about a setting that is not supported by the hardware.

Can you try the following lines and check if they all run without an error?

imaqreset
adaptorName = 'winvideo';
vidObj = videoinput(adaptorName); %get video object
src = getselectedsource(vidObj);

try
    handles.FrameRate.Style = 'popupmenu'; %change menu style to indicate available frame rates
    handles.FrameRate.String = set(src, 'FrameRate');
    src.FrameRate = handles.FrameRate.String{1}; %use highest available frame rate
catch
    handles.FrameRate.String = {'30'};
end

%setup and display live video feed in preview window
vidRes = get(vidObj,'VideoResolution');
nbands = get(vidObj,'NumberOfBands');
handles.CurrentResolution.String = [num2str(vidRes(1)) ' x ' num2str(vidRes(2))]; %update current resolution indicator
imshow(zeros(vidRes(2),vidRes(1),nbands),[]); %create image object for preview

%set default camera configuration
handles.ROIposition = [0 0 vidRes];  %default ROIposition
set(vidObj,'TriggerFrameDelay',0);
set(vidObj,'FrameGrabInterval',1);
set(vidObj,'TriggerRepeat',0);
set(vidObj,'ROIposition',handles.ROIposition);
set(vidObj,'FramesPerTrigger',Inf);
triggerconfig(vidObj,'manual');
preview(vidObj)
musall commented 3 months ago

ah for adaptorName you would have to set 'matrox'.

adaptorName = 'matrox ';