You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...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};
The text was updated successfully, but these errors were encountered:
...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};
The text was updated successfully, but these errors were encountered: