Quantcast
Channel: sr's lair
Viewing all articles
Browse latest Browse all 688

fswebcam focus 옵션

$
0
0

기록용으로 남깁니다.

raspberry pi 4 에서 fswebcam 으로 사진을 찍을 때 조명이 부족한 야간에 포커스를 자동으로 잡지 못해서 사진이 뿌옇게 나오는 경우가 있었습니다.

문서를 찾아보던 중 github 이슈 페이지에서 힌트를 얻어 일단 auto focus 를 끄고 강제로 focus 값을 지정하는 코드까지는 확인했습니다. 하지만, 사무실에서 테스트용으로 옵션 변경해서 얻은 실제 화질은 크게 차이가 나지 않아서 실제 외부에서 focus 값이 어떻게 얼마나 영향을 주는지를 확인해봐야 하는 작업이 남았습니다..

fswebcam --list-controls 명령으로 현재 지정된 옵션과 지정 가능한 값 범위(Range)를 확인합니다.

$ fswebcam --list-controls
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Available Controls        Current Value   Range
------------------        -------------   -----
Brightness                0 (50%)         -64 - 64
Contrast                  32 (32%)        0 - 100
Saturation                50 (50%)        0 - 100
Hue                       0 (50%)         -180 - 180
White Balance Temperature, Auto True            True | False
Gamma                     300 (50%)       100 - 500
Gain                      64 (50%)        0 - 128
Power Line Frequency      50 Hz           Disabled | 50 Hz | 60 Hz
White Balance Temperature 4600 (48%)      2800 - 6500
Sharpness                 0 (0%)          0 - 100
Backlight Compensation    0               0 - 2
Exposure, Auto            Aperture Priority Mode Manual Mode | Aperture Priority Mode
Exposure (Absolute)       625 (5%)        50 - 10000
Exposure, Auto Priority   True            True | False
Focus (absolute)          68 (6%)         0 - 1023
Focus, Auto               True            True | False
Adjusting resolution from 384x288 to 424x240.

Focus 항목을 수정해야 하는데 그냥 --set Focus, Auto=False --set Focus (absolute)=1 같이 지정하면 옵션이 인식안되고 옵션 이름으로 파일이 저장되었습니다..
아래와 같이 큰 따옴표로 묶어 주니 해당 옵션이 지정되는 것으로 보입니다.

$ fswebcam -r 640x480 --rotate 180 -S 50 --set brightness=50% --jpeg 95 --set "Focus, Auto"=False --set "Focus (Absolute)"=10 k10.jpg
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Setting Brightness to 0 (50%).
Setting Focus (absolute) to 10 (0%).
Setting Focus, Auto to False (0).
--- Capturing frame...
Skipping 50 frames...
Capturing 1 frames...
Captured 51 frames in 1.67 seconds. (30 fps)
--- Processing captured image...
Flipping image horizontally.
Flipping image vertically.
Setting output format to JPEG, quality 95
Writing JPEG image to 'k10.jpg'.


Viewing all articles
Browse latest Browse all 688

Trending Articles