Meat with Onions and Tomatos
$25.95
Shrimps with Tomatos and Avocados
$17.95
Vanila Ice-Cream and Pancakes
$13.95
About Me
Monday, 21 July 2014
Sobel
#include "stdafx.h"#include <stdio.h>#include <highgui.h>#include <cv.h>#include <cxcore.h>void main(){ //Sobel edge detection for a videoCvCapture* capture = cvCreateFileCapture("testIP_vid.avi"); //The video is loaded into a pointer of type CvCaptureIplImage* frame; IplImage*gscale_res; IplImage* edgeframe; //Declaration of structure variables to store frameschar *win = "video"; char *winEdge = "edges"; //Declaration of character pointers to store window namescvNamedWindow(win,CV_WINDOW_AUTOSIZE); //Window is created for original imagecvNamedWindow(winEdge,CV_WINDOW_AUTOSIZE); //Window is created for resultant imagewhile(1){frame = cvQueryFrame(capture); //Image under consideration is captured as a shot of the videogscale_res = cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_8U,1);//Creation of the image variable to store both the grayscale intermediate and final resultedgeframe = cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_16S,1); //The 16-bit signed image for the result of the Sobel Edge detectioncvCvtColor(frame,gscale_res,CV_BGR2GRAY); //Gray-scale intermediate createdcvSobel(gscale_res,edgeframe,1,0,3);// Sobel edge detection function is applied on the grayscale image and the result is put in the other variablecvConvertScaleAbs(edgeframe,gscale_res,1,0); //The 16-bit signed image is converted to an 8-bit unsigned version so it can be displayedcvShowImage(win,frame); //Original image is showncvShowImage(winEdge,gscale_res); //Resultant image with edges detected, is shownchar c = cvWaitKey(33); //This is to account for the frame speed of the loaded videocvReleaseImage(&gscale_res);cvReleaseImage(&edgeframe);if(c==27) //If the character of code 27 or the ESCAPE character is entered, the loop will breakbreak;}cvReleaseCapture(&capture); //Video is released from memorycvReleaseImage(&frame); //Images released from memorycvDestroyWindow(win);cvDestroyWindow(winEdge); //Windows closed}
My First Blog
Hello, I m raj
Subscribe to:
Posts
(Atom)