Skip to content

Commit

Permalink
扫描边缘
Browse files Browse the repository at this point in the history
  • Loading branch information
itrufeng committed Apr 18, 2011
1 parent b76d2a5 commit 40b44c2
Show file tree
Hide file tree
Showing 7 changed files with 2,173 additions and 0 deletions.
950 changes: 950 additions & 0 deletions 20110418/CannyCapture/.cproject

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions 20110418/CannyCapture/.project
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CannyCapture</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/CannyCapture/Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
45 changes: 45 additions & 0 deletions 20110418/CannyCapture/main.cpp
@@ -0,0 +1,45 @@
/*c
* main.cpp
*
* Created on: 2011-4-17
* Author: itrufeng
*/

#include <opencv/cv.h>
#include <opencv/highgui.h>
// aperture 光圈
IplImage* canny(IplImage *inputImage,float lowThresh,float highThresh,float aperture){
IplImage *outputImage;
if(inputImage->nChannels>1){
printf("not gray image.");
}
outputImage = cvCreateImage(cvGetSize(inputImage),IPL_DEPTH_8U,1);
cvCanny(inputImage,outputImage,lowThresh,highThresh,aperture);
return outputImage;
}

int main(int args,char *argv[]){
CvCapture *capture = NULL;
IplImage *image;
cvNamedWindow("inputImage",CV_WINDOW_AUTOSIZE);
cvMoveWindow("inputImage",100,100);
capture = cvCreateCameraCapture(CV_CAP_ANY);
while(image=cvQueryFrame(capture)){
IplImage *grayImage = cvCreateImage(cvGetSize(image),image->depth,1);
IplImage *cannyImage = cvCreateImage(cvGetSize(grayImage),IPL_DEPTH_8U,1);
cvCvtColor(image,grayImage,CV_RGB2GRAY);
// float lowThresh 内部轮廓。数字越大越模糊
// float highThresh //外部轮廓。数字越大越模糊
// float aperture
cannyImage = canny(grayImage,20,20,3);
cvShowImage("inputImage",cannyImage);
if(cvWaitKey(2)>0)
break;
cvReleaseImage(&cannyImage);
cvReleaseImage(&grayImage);
}
//
cvDestroyWindow("inputImage");
cvReleaseCapture(&capture);
return 0;
}

0 comments on commit 40b44c2

Please sign in to comment.