2 using System.Collections.Generic;
5 using System.Windows.Forms;
6 using System.Reflection;
9 namespace User.SampleCode
19 FVIL.Data.CFviImage src = null;
20 FVIL.Data.CFviImage dst = null;
21 FHANDLE hfga_src = IntPtr.Zero;
22 FHANDLE hfga_dst1 = IntPtr.Zero;
23 FHANDLE hfga_dst2 = IntPtr.Zero;
25 if (fga.fnFGA_is_setuped() ==
false)
return;
31 src =
new FVIL.Data.CFviImage(
"Data/key_UC8_M.png");
33 int type = api.fnFIE_img_get_type( src.GetFIE() );
34 int channels = api.fnFIE_img_get_channels( src.GetFIE() );
35 int width = api.fnFIE_img_get_width( src.GetFIE() );
36 int height = api.fnFIE_img_get_height( src.GetFIE() );
39 hfga_src = fga.fnFGA_img_root_alloc( type, channels, width, height );
42 fga.fnFGA_img_copy( src.GetFIE(), hfga_src );
47 int type = fga.fnFGA_img_get_type( hfga_src );
48 int channels = fga.fnFGA_img_get_channels( hfga_src );
49 int width = fga.fnFGA_img_get_width( hfga_src );
50 int height = fga.fnFGA_img_get_height( hfga_src );
53 hfga_dst1 = fga.fnFGA_img_root_alloc( type, channels, width, height );
54 hfga_dst2 = fga.fnFGA_img_root_alloc( type, channels, width, height );
57 status = fga.fnFGA_average(hfga_src, hfga_dst1, f_border_mode.F_BORDER_CONTINUOUS, 0.0);
58 if (status != (
int)f_err.F_ERR_NONE)
60 Console.WriteLine(
"fnFGA_average failed.({0})", (f_err)status);
61 throw new FvException((f_err)status);
65 status = fga.fnFGA_sobel(hfga_dst1, hfga_dst2, f_sobel_mode.F_SOBEL_XY_MODE, f_border_mode.F_BORDER_CONTINUOUS, 0.0);
66 if (status != (
int)f_err.F_ERR_NONE)
68 Console.WriteLine(
"fnFGA_sobel failed.({0})", (f_err)status);
69 throw new FvException((f_err)status);
75 int type = fga.fnFGA_img_get_type(hfga_dst2);
76 int channels = fga.fnFGA_img_get_channels(hfga_dst2);
77 int width = fga.fnFGA_img_get_width(hfga_dst2);
78 int height = fga.fnFGA_img_get_height(hfga_dst2);
81 FHANDLE hfie_dst = api.fnFIE_img_root_alloc( type, channels, width, height );
84 fga.fnFGA_img_copy( hfga_dst2, hfie_dst );
87 dst =
new FVIL.Data.CFviImage(hfie_dst,
false);
88 dst.Save(
"Result/Result3.png");
110 int status = fga.fnFGA_setup();
112 if (status == (
int)f_err.F_ERR_NONE)
118 fga.fnFGA_teardown();