Woohoo! I did it!

I have seen other postings on cropping before, so if anyone is interested to
see how I did it, here's the code snippet:

In my case: (x,y)=(72,56) and (width,height)=(660,382)

for (i = y; i < (y + height); i++)
{
    for (j = (x * 2); j < ((x + width) * 2); j++)
    {
        data[((i - y) * (width * 2)) + ((j - (x * 2)) + 1)] =
            temp[(i * (width * 2)) + (j + 1)];
    }
}

This little bit of code copies the rectangle that we are interested in from
the "temp" buffer into the beginning of the "data" buffer. The "temp" buffer
is the full frame, as captured by v4l. The "data" buffer is a user allocated
buffer to hold the "interesting" data from the full frame.

I hope that someone will find this useful.

/G



--
video4linux-list mailing list
Unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/video4linux-list

Reply via email to