77using System . Threading . Tasks ;
88using OpenCvSharp ;
99using SmartImage . Lib ;
10+ using SmartImage . Lib . Engines . Impl ;
11+ using SmartImage . Lib . Searching ;
1012using SmartImage . Lib . Utilities ;
13+ using Point = OpenCvSharp . Point ;
1114using Range = System . Range ;
15+ using Size = OpenCvSharp . Size ;
1216
1317#pragma warning disable IDE0079
1418#pragma warning disable CS0168 , CS1998
@@ -37,7 +41,31 @@ public static void OnResult(object _, ResultCompletedEventArgs e)
3741 public static async Task Main ( string [ ] args )
3842 {
3943
40- /*var q = new ImageQuery(@"C:\Users\Deci\Pictures\Test Images\Test6.jpg");
44+
45+ await test4 ( ) ;
46+
47+ }
48+
49+ static async Task test5 ( )
50+ {
51+ var b = ImageHelper . IsImage ( @"http://i235.photobucket.com/albums/ee99/jay911_50/anime/bl/omfg.png" ,
52+ out var di ) ;
53+
54+ Console . WriteLine ( b ) ;
55+ }
56+ static async Task test4 ( )
57+ {
58+ var task = await ImageHelper . ScanForImages (
59+ "https://www.deviantart.com/sciamano240/art/Y-shtola-Final-Fantasy-2v-898752157" ) ;
60+
61+ foreach ( DirectImage v in task ) {
62+ Console . WriteLine ( v ) ;
63+ }
64+ }
65+
66+ static async Task test3 ( )
67+ {
68+ var q = new ImageQuery ( @"C:\Users\Deci\Pictures\Test Images\Test6.jpg" ) ;
4169 var engine = new SauceNaoEngine ( ) { } ;
4270 engine . Authentication = "362e7e82bc8cf7f6025431fbf3006510057298c3" ;
4371 var task = engine . GetResultAsync ( q ) ;
@@ -54,10 +82,13 @@ public static async Task Main(string[] args)
5482
5583 Console . WriteLine ( ">> {0}" , result ) ;
5684 var result2 = await task2 ;
57- Console.WriteLine(">> {0}", result2);*/
85+ Console . WriteLine ( ">> {0}" , result2 ) ;
86+ }
5887
59- /*const double C1 = 6.5025, C2 = 58.5225;
60- /***************************** INITS *********************************#1#
88+ static void test2 ( )
89+ {
90+ const double C1 = 6.5025 , C2 = 58.5225 ;
91+ /***************************** INITS **********************************/
6192 MatType d = MatType . CV_32F ;
6293
6394 Mat i1 = new ( @"C:\Users\Deci\Pictures\b.jpg" ) , i2 = new ( @"C:\Users\Deci\Pictures\c.jpg" ) ;
@@ -67,10 +98,10 @@ public static async Task Main(string[] args)
6798 var p1 = i1 . Width * i1 . Height ;
6899 var p2 = i2 . Width * i2 . Height ;
69100
70- if (p1> p2) {
101+ if ( p1 > p2 ) {
71102
72103
73- var x = i1[new Rect(new Point(0,0), i2.Size())];
104+ var x = i1 [ new Rect ( new Point ( 0 , 0 ) , i2 . Size ( ) ) ] ;
74105
75106 //x.SaveImage(@"C:\Users\Deci\Pictures\x.jpg");
76107 //i1 = i1.Resize(i2.Size());
@@ -84,7 +115,7 @@ public static async Task Main(string[] args)
84115 Mat i12 = i1 . Mul ( i1 ) ; // I1^2
85116 Mat i1I2 = i1 . Mul ( i2 ) ; // I1 * I2
86117
87- /***********************PRELIMINARY COMPUTING *****************************#1#
118+ /***********************PRELIMINARY COMPUTING ******************************/
88119
89120 Mat mu1 = new ( ) , mu2 = new ( ) ; //
90121 Cv2 . GaussianBlur ( i1 , mu1 , new Size ( 11 , 11 ) , 1.5 ) ;
@@ -124,9 +155,13 @@ public static async Task Main(string[] args)
124155 SSIMResult result = new SSIMResult ( ) ;
125156 result . diff = ssimMap ;
126157 result . mssim = mssim ;
127- Console.WriteLine(result.score);*/
158+ Console . WriteLine ( result . score ) ;
159+ }
128160
129- /*Console.WriteLine(ImageHelper.IsImage(@"http://i235.photobucket.com/albums/ee99/jay911_50/anime/bl/omfg.png", out var di));
161+ static void test1 ( )
162+ {
163+ Console . WriteLine ( ImageHelper . IsImage ( @"http://i235.photobucket.com/albums/ee99/jay911_50/anime/bl/omfg.png" ,
164+ out var di ) ) ;
130165
131166 Debugger . Break ( ) ;
132167 var wc = new WebClient ( ) ;
@@ -141,17 +176,10 @@ public static async Task Main(string[] args)
141176 var path = Environment . GetFolderPath ( Environment . SpecialFolder . Desktop ) ;
142177 string s = Path . Combine ( path , name2 + "-1" + ext ) ;
143178 Console . WriteLine ( s ) ;
144- img2.Save(s);*/
145-
146- var task = await ImageHelper . ScanForImages ( "https://www.deviantart.com/sciamano240/art/Y-shtola-Final-Fantasy-2v-898752157" ) ;
147-
148- foreach ( DirectImage v in task ) {
149- Console . WriteLine ( v ) ;
150- }
151-
179+ img2 . Save ( s ) ;
152180 }
153181
154- /* public class SSIMResult
182+ public class SSIMResult
155183 {
156184 public double score
157185 {
@@ -160,5 +188,5 @@ public double score
160188
161189 public Scalar mssim ;
162190 public Mat diff ;
163- }*/
191+ }
164192}
0 commit comments