필터 지우기
필터 지우기

Image Acquisition - Resolution

조회 수: 2 (최근 30일)
Jake Bolanski
Jake Bolanski 2011년 11월 2일
Hello,
I am trying to get a picture using a webcam in MatLab. I am successfully able to obtain the picture and such by using the following code:
picture = videoinput('macvideo',1);
cam_image_rgb = getsnapshot(picture);
imshow(cam_image_rgb)
By default, the resolution of the image is set to 1280x720. How would I go about changing this to 800x600? I am aware that I can do this manually by clicking on 800x600 within the toolbox; however, I cannot use the toolbox as this project cannot have any manual intervention. Therefore, I am using the code above within the .m file.
  댓글 수: 1
Jake Bolanski
Jake Bolanski 2011년 11월 2일
Here is the result I obtain when I do:
propinfo(picture, 'VideoResolution')
ans =
Type: 'double'
Constraint: 'none'
ConstraintValue: []
DefaultValue: [1280 720]
ReadOnly: 'always'
DeviceSpecific: 0
Any clue on how I would change the [1280 720] to [800 600]? set(propinfo(picture, 'VideoResolution'), [800 600]) yields "Error using set
Conversion to double from struct is not possible."

댓글을 달려면 로그인하십시오.

채택된 답변

Jake Bolanski
Jake Bolanski 2011년 11월 2일
Okay this was much easier than I originally thought. Depending on what is visible under your camera in the actual Image Acquisition Toolbox, you can easily pick the correct resolution (assuming your camera supports it) by:
picture = videoinput('macvideo',1,'YCbCr422_1280x720');
where the 'YCbCr422_1280x720' should be changed to 'YCbCr422_800x600' or whatever your camera names it as.
  댓글 수: 1
Image Analyst
Image Analyst 2011년 11월 2일
I thought you couldn't use the toolbox functions.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by