"Exercise 6.6" cvlaplace Mass and edge detection

Source: Internet
Author: User

Outline
Topic Requirements
Program code
Result picture
Homilies Miao DAO

Title Requirements:

Find and load a frontal face graph, the eyes are open, and take up most of the image area, write code to find the eyes of the pupil

A Laplace operator "like" a central highlight in the darkness, the pupil is just the opposite, with a large enough Laplace operator to convert and convolution

Program code:

1 //OpenCVExerciseTesting.cpp: Defines the entry point of the console application. 2 //3 //d:\\work\\work_programming\\source\\image\\lena.jpg4 5 6#include"stdafx.h"7#include <cv.h>8#include 9#include <iostream>Ten  One#include <opencv2/legacy/legacy.hpp> A //#pragma comment (lib, "Opencv_legacy2411.lib") -  - using namespaceCV; the using namespacestd; -  - //function declaration---->-->--->-->--->-->--->// -  +  - //<--<--<--<--<--<--<--<--<--Function Declaration// +  A int_tmain (intARGC, _tchar*argv[]) at { -     Const Char* Soutcefile ="d:\\work\\work_programming\\source\\image\\opencvexerciseimage\\ the 6th chapter \ \ pupil. jpg"; -Iplimage * Image_resource =cvloadimage (Soutcefile, cv_load_image_grayscale); - assert (Image_resource); -  -Cvsize image_size = cvsize (Image_resource->width, image_resource->height); in  -Cvnamedwindow ("Original Image", cv_window_autosize); toCvnamedwindow ("Topic _a", cv_window_autosize); +  -Cvshowimage ("Original Image", Image_resource); the  *     //---------------------------A:--------------------------------/: $ Panax NotoginsengIplimage * image_result_a = Cvcreateimage (image_size, ipl_depth_64f, image_resource->nchannels); - Cvzero (image_result_a); the  +Cvlaplace (Image_resource, Image_result_a, +); A  theCvsave ("Image_result_a.xml", image_result_a); +  -Iplimage * image_8u_toshow = Cvcreateimage (image_size, ipl_depth_8u, image_resource->nchannels); $ cvconvertscaleabs (image_result_a, image_8u_toshow); $  -Cvshowimage ("Topic _a", image_8u_toshow); -  the     //---------------------------A:--------------------------------/.  - WuyiCvwaitkey (0); the  -Cvreleaseimage (&image_resource); WuCvreleaseimage (&image_result_a); -  AboutCvdestroywindow ("Original Image"); $Cvdestroywindow ("Topic _a"); -  -     return 0; -}

Result Picture:

If you change a picture, replace it with the following code:

    Const Char " d:\\work\\work_programming\\source\\image\\opencvexerciseimage\\ the 6th chapter \ \ eyes. jpg " ; /// .......      ); 

Homilies Miao DAO:

A common application of ① Laplace operators is to detect "clumps", edge detection

The ② source image can be either a 8-bit unsigned image or a 32 floating-point image, but the target image must be a 16-bit (signed) or 32-bit floating-point image.

"Exercise 6.6" cvlaplace Mass and edge detection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.