Skip to content

Add webcam example to image acquisition module.... #92

@Shrediquette

Description

@Shrediquette

...so users can play with the interface using their webcam. Don't use imaqtoolbox, but the free Webcam addon. Just use some resolution, so no extra settings available, like in my code ehre:

cam = webcam(1);
disp('Using the first webcam from the list of available webcams.')
%% Setting camera to a suitable resolution
desired_resolution = 320; %this is the desired resolution for this example
available_resolutions=cam.AvailableResolutions;
width=zeros(numel(available_resolutions));
for i=1:numel(available_resolutions)
temp = strsplit(available_resolutions{i},'x');
width(i)=str2double(temp{1});
end
index_of_suitable_resolution = find(width>desired_resolution-50 & width < desired_resolution+50);
if isempty(index_of_suitable_resolution)
index_of_suitable_resolution = numel(available_resolutions); %take the last listed resolution
end
index_of_suitable_resolution=index_of_suitable_resolution(1); %take only the first element if more suitable resolutions were found
cam.Resolution=available_resolutions{index_of_suitable_resolution};

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions