Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/
# Include "CV. H "# include" highgui. H "# include <ctype. h> # include <stdio. h> int main (INT argc, char ** argv) {iplimage * Laplace = 0; iplimage * coloelaploud = 0; iplimage * PLANeS [3] = {0, 0 }; // multiple image faces cvcapture * capture = 0; If (argc = 1 | (argc = 2 & strlen (argv [1]) = 1 & isdigit (argv [1] [0]) {capture = cvcapturefromcam (-1);} else if (argc = 2) {capture = cvcapturefromavi (argv [1]);} If (! Capture) {fprintf (stderr, "cocould not initialize capturing... /n "); Return-1;} cvnamedwindow (" Main ", 0); For (;) {iplimage * frame = 0; int I; frame = cvqueryframe (capture); // capture from the camera or file and return a frame if (! Frame) {break;} If (! Laplace) {for (I = 0; I <3; I ++) {planes [I] = cvcreateimage (cvsize (frame-> width, frame-> height ), 8, 1);} Laplace = cvcreateimage (cvsize (frame-> width, frame-> height), ipl_depth_16s, 1); coloelaplace = cvcreateimage (cvsize (frame-> width, frame-> height), 8, 3);} cvcvtpixtoplane (frame, planes [0], planes [1], planes [2], 0 ); // # define cvcvtpixtoplane cvsplit for (I = 0; I <3; I ++) {cvlaplace (planes [I], Laplace, 3 ); // calculate the Laplacian transformation of image planes [I] cvconvertscaleabs (Laplace, planes [I],); // planes [] = ABS (Laplace )} cvcvtplanetopix (planes [0], planes [1], planes [2], 0, coloelaplace); // # define cvcvtplanetopix cvmerge coloelap--> origin = frame-> origin; cvshowimage ("Main", coloelaploud); If (cvwaitkey (10) >=0) {break ;}} cvreleasecapture (& capture); cvdestroywindow ("Main "); return 0 ;}
Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/