table表头标题th浮动提示-MyTable.js
最近这两天一直在研究命令行参数的编译,现代吗如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 |
#include <highgui.h> #include <math.h> #include <cv.h> IplImage *Igray = 0, *It = 0, *Iat; int main( int
argc, char ** argv ) { //输入命令行 double
threshold = ( double ) atof ( argv[1] ); //convert string to double int
threshold_type = atoi ( argv[2] ) ? CV_THRESH_BINARY : CV_THRESH_BINARY_INV; int
adaptive_method = atoi ( argv[3] ) ? CV_ADAPTIVE_THRESH_MEAN_C : CV_ADAPTIVE_THRESH_GAUSSIAN_C; int
block_size = atoi ( argv[4] ); double
offset = ( double ) atof ( argv[5] ); //加载灰度图 if ( ( Igray = cvLoadImage( argv[6], CV_LOAD_IMAGE_GRAYSCALE ) ) == 0 ) { return
-1; } //创建同样大小8位灰度图用于输出 It = cvCreateImage( cvSize( Igray -> width, Igray -> height ), IPL_DEPTH_8U, 1 ); //单通道8位灰度图 Iat = cvCreateImage( cvSize( Igray -> width, Igray -> height ), IPL_DEPTH_8U, 1 ); //阈值化 cvThreshold( Igray, It, threshold, 255, threshold_type ); cvAdaptiveThreshold( Igray, Iat, 255, adaptive_method, threshold_type, block_size, offset ); //命名窗体输出 cvNamedWindow( "Raw" , 1 ); cvNamedWindow( "Threshold" , 1 ); cvNamedWindow( "Adaptive Threshold" , 1 ); cvShowImage( "Raw" , Igray ); cvShowImage( "Threshold" , It ); cvShowImage( "Adaptive Threshold" , Iat ); cvWaitKey(0); //回收内存 cvReleaseImage( &Igray ); cvReleaseImage( &It ); cvReleaseImage( &Iat ); cvDestroyWindow( "Raw"
); cvDestroyWindow( "Threshold"
); cvDestroyWindow( "Adaptive Threshold"
); return
0; } |
上述代码是二值化和自适应二值化的比较,在该工程文件夹同级目录下面的Debug文件找到 自适应阈值.exe 文件,然后打开命令行提示符,针对上述文件可进行下面操作:
1,首先进到Debug文件,找到.exe文件,如D:\myopencv\opencv\Code\Opencv\Debug
2,在命令行输入下面:
D:\myopencv\opencv\Code\Opencv\Debug>自适应阈值.exe 15 1 1 71 15 D:\myopencv\opencv\Code\Opencv\自适应阈值\2.jpg
3,结果如下:
简单的和大家分享一下。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。