video - Analyzing camera feed under OSX -
i looking way programmatically analyze video feed external usb webcam under osx.
since haven't done low level programming before kind of lost on start.
how can access webcam feed , grab image data process further? @ point trying understand basic concept , not looking language-specific solutions. sample code highly appreciated.
i'd appreciate if point me in right direction , me started.
thank in advance!
thomas
use opencv.
and check previous answer on subject if looking code example display webcam images. converts video feed grayscale , displays them on window:
if want display frames, replace else block this:
else { cvshowimage("colored video", color_frame); }
in case wandering how manipulate pixels of frame:
int width = color_frame->width; int height = color_frame->height; int bpp = color_frame->nchannels; (int i=0; < width*height*bpp; i+=bpp) { if (!(i % (width*bpp))) // print empty line better readability std::cout << std::endl; std::cout << std::dec << "r:" << (int) color_frame->imagedata[i] << " g:" << (int) color_frame->imagedata[i+1] << " b:" << (int) color_frame->imagedata[i+2] << " "; }
Comments
Post a Comment