v4l2


Any known-to-work example in C using VIDIOC_S_CROP in V4L2?


I'm working with V4L2 trying to use VIDIOC_S_CROP to retrieve only a portion of the full image available from the camera. The one snippet of code I found (abbreviated below) from linuxtv.org uses VIDIOC_CROPCAP to retrieve the default rectangle, then VIDIOC_S_CROP to use the default rectangle as the cropping area. I need to do more, but even this simple case doesn't seem to work on any camera (USB) I've tried...
int fd;
struct v4l2_crop crop;
struct v4l2_cropcap cropcap;
CLEAR(crop);
CLEAR(cropcap);
cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fd = open("/dev/video0", O_RDWR | O_NONBLOCK, 0);
if(xioctl(fd, VIDIOC_CROPCAP, &cropcap) == -1) {
perror("VIDIOC_CROPCAP");
return(-1);
}
crop.c = cropcap.defrect;
if (xioctl(fd, VIDIOC_S_CROP, &crop) == -1) {
perror("VIDIOC_S_CROP");
return(-1);
}
It fails in the VIDIOC_S_CROP call, returning error code:
"Inappropriate ioctl for device". I suppose its quite possible that every camera I've tried just doesn't support cropping, but I'd really like to know if anyone has successfully used VIDIOC_S_CROP so I know if I'm using it incorrectly or just have not found a camera that supports it. I've tried this with several different cameras and several different Linux boxes, all giving the same result.
Thanks,

Related Links

V4L2 frame rate maxes out at ~10FPS… why?
Any known-to-work example in C using VIDIOC_S_CROP in V4L2?
Getting framesize in V4L2 with VIDIOC_ENUM_FRAMESIZES
A4Tech webcam and avconv (ffmpeg) captures same frame all the time
yavta cause kernel panic (ov5640 with DM3730)
V4L2 preview with callback instead of polling-loop
Function call ioctl with VIDIOC_QUERYCAP request doesn't return
V4L2 difference between JPEG and MJPEG pixel formats
v4l2-ctl not changing from default webcam
Where I can find example in using v4l2 codec driver
Timestamp for v4l2 image capture
Where does v4l2_buffer->timestamp value starts counting?

Categories

HOME
postgresql
compression
customization
spotfire
crm
arguments
hiveql
coordinates
sdk
perl6
autocad
gnuradio
rethinkdb
osx-yosemite
revit-api
mongodb-replica-set
jinja2
minimum
k-means
vivado-hls
keystone
angular2-pipe
javaagents
traveling-salesman
scripting-language
xlib
mobile-development
andengine
lines
mplab
circle
offset
javax
mkdir
kofax
android-databinding
maven-2
scip
blueimp
compiler-warnings
mtm
test-kitchen
amazon-rds-aurora
android-doze-and-standby
geminabox
beanshell
px4
playframework-1.x
selection-sort
huawei
easy68k
mac-app-store
recurring
change-password
avi
android-progressbar
nugetgallery
wordpress-plugin
notice
vanilla-forums
consul-template
autoscaling
eggplant
grails-3.0.9
system.diagnostics
httpmodule
valdr-bean-validation
ultraedit
genero
autopep8
os.walk
indic
serializer
atg-dynamo
isl
sigma-grid-control
image-preloader
nvcc
mysql2
nsautoreleasepool
brew
biztalk-deployment
metapost
systrace
bindinglist
unordered-set
joomla1.7
scriptmanager
automapper-2
lwp
onunload
conditional-operator
viewdata
oaw
calendarextender
httpbrowsercapabilities
moores-law

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile