Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Shrediquette opened this issue Aug 4, 2023 · 0 comments
Open

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

Shrediquette opened this issue Aug 4, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Shrediquette
Copy link
Owner

...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};

@Shrediquette Shrediquette added the enhancement New feature or request label Aug 4, 2023
@Shrediquette Shrediquette self-assigned this Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant