照度差ステレオ光源ベクトルの情報補助関数(リング照明)
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_ps_woodham_calc_light_ring( double height, double radius, double initial_angle, int light_order, DOUBLE_PTR slant, DOUBLE_PTR tilt, int n ) |
Visual Basic |
---|
Public Shared Function fnFIE_ps_woodham_calc_light_ring ( height As Double, radius As Double, initial_angle As Double, light_order As Integer, slant As DOUBLE_PTR, tilt As DOUBLE_PTR, n As Integer ) As Integer |
Parameters
- height
- Type: System..::..Double
光源の高さ(0<height)
- radius
- Type: System..::..Double
光源の半径(0<radius)
- initial_angle
- Type: System..::..Double
光源の初期角度(0≦initial_angle<360)
- light_order
- Type: System..::..Int32
光源の点灯順序
- slant
- Type: fvalgcli..::..DOUBLE_PTR
出力光源ベクトルの情報である slant の配列 (要素数 n)
- tilt
- Type: fvalgcli..::..DOUBLE_PTR
出力光源ベクトルの情報である tilt の配列 (要素数 n)
- n
- Type: System..::..Int32
光源の個数(1以上の整数)
Return Value
Type: Int32以下のエラーコードを返します。
エラーコード:
f_err | 内容 |
---|---|
F_ERR_NONE | 正常終了 |
F_ERR_NOMEMORY | メモリ不足 |
F_ERR_INVALID_IMAGE | 不正な画像オブジェクト |
F_ERR_INVALID_PARAM | パラメータ異常 |
F_ERR_CALC_IMPOSSIBLE | 計算不能エラー |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Examples
C# | Copy |
---|---|
using System; using System.Collections.Generic; using System.Text; using fvalgcli; namespace TC { public partial class FIE { [FvPluginExecute] public void fnFIE_ps_woodham_calc_light_ring() { int status = (int)f_err.F_ERR_NONE; FHANDLE hsrc = FHANDLE.Zero; FHANDLE hdst_normal = FHANDLE.Zero; FHANDLE hdst_albedo = FHANDLE.Zero; DOUBLE_PTR slant = IntPtr.Zero; DOUBLE_PTR tilt = IntPtr.Zero; try { // 入力画像: (ファイル読み込み) api.fnFIE_load_img_file(TestImageDir + "/TC/PS/fie_ps_sample-uc8.png", ref hsrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8); // 入力画像の情報取得. int width = api.fnFIE_img_get_width(hsrc); int height = api.fnFIE_img_get_height(hsrc); int channels = api.fnFIE_img_get_channels(hsrc); // 出力画像の生成. hdst_normal = api.fnFIE_img_root_alloc(f_imgtype.F_IMG_DOUBLE, 3, width, height); hdst_albedo = api.fnFIE_img_root_alloc(f_imgtype.F_IMG_DOUBLE, 1, width, height); // 光源ベクトル の情報. slant = DOUBLE_PTR.alloc(channels); tilt = DOUBLE_PTR.alloc(channels); // 光源ベクトルの情報補助関数. status = api.fnFIE_ps_woodham_calc_light_ring(2, 1, 170, 0, slant, tilt, channels); if (status != 0) throw new FvException(status); // 処理の実行. status = api.fnFIE_ps_woodham(hsrc, slant, tilt, hdst_normal, hdst_albedo); if (status != 0) throw new FvException(status); // 出力画像の保存. api.fnFIE_save_tiff(ResultDir + "/fnFIE_ps_woodham_calc_light_ring-normal.tiff", hdst_normal, f_tiff_compression.F_TIFF_COMPRESSION_DEFLATE, -1); api.fnFIE_save_tiff(ResultDir + "/fnFIE_ps_woodham_calc_light_ring-albedo.tiff", hdst_albedo, f_tiff_compression.F_TIFF_COMPRESSION_DEFLATE, -1); // 光源ベクトルの情報: (slant) Console.Write("slant = "); for (int i = 0; i < channels; i++) { Console.Write("{0} ", slant[i]); } Console.WriteLine(""); // 光源ベクトルの情報: (tilt) Console.Write("tilt = "); for (int i = 0; i < channels; i++) { Console.Write("{0} ", tilt[i]); } Console.WriteLine(""); } finally { hsrc.Dispose(); hdst_normal.Dispose(); hdst_albedo.Dispose(); slant.Dispose(); tilt.Dispose(); } } } } |
Visual Basic | Copy |
---|---|
Imports System.Collections.Generic Imports System.Text Imports fvalgcli Public Partial Class FIE <FvPluginExecute> _ Public Sub fnFIE_ps_woodham_calc_light_ring() Dim status As Integer = CInt(f_err.F_ERR_NONE) Dim hsrc As FHANDLE = FHANDLE.Zero Dim hdst_normal As FHANDLE = FHANDLE.Zero Dim hdst_albedo As FHANDLE = FHANDLE.Zero Dim slant As DOUBLE_PTR = IntPtr.Zero Dim tilt As DOUBLE_PTR = IntPtr.Zero Try ' 入力画像: (ファイル読み込み) api.fnFIE_load_img_file(TestImageDir & "/TC/PS/fie_ps_sample-uc8.png", _ hsrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8) ' 入力画像の情報取得. Dim width As Integer = api.fnFIE_img_get_width(hsrc) Dim height As Integer = api.fnFIE_img_get_height(hsrc) Dim channels As Integer = api.fnFIE_img_get_channels(hsrc) ' 出力画像の生成. hdst_normal = api.fnFIE_img_root_alloc(f_imgtype.F_IMG_DOUBLE, 3, width, height) hdst_albedo = api.fnFIE_img_root_alloc(f_imgtype.F_IMG_DOUBLE, 1, width, height) ' 光源ベクトル の情報. slant = DOUBLE_PTR.alloc(channels) tilt = DOUBLE_PTR.alloc(channels) ' 光源ベクトルの情報補助関数. status = api.fnFIE_ps_woodham_calc_light_ring(2, 1, 170, 0, slant, tilt, _ channels) If status <> 0 Then Throw New FvException(status) End If ' 処理の実行. status = api.fnFIE_ps_woodham(hsrc, slant, tilt, hdst_normal, hdst_albedo) If status <> 0 Then Throw New FvException(status) End If ' 出力画像の保存. api.fnFIE_save_tiff(ResultDir & "/fnFIE_ps_woodham_calc_light_ring-normal.tiff", _ hdst_normal, f_tiff_compression.F_TIFF_COMPRESSION_DEFLATE, -1) api.fnFIE_save_tiff(ResultDir & "/fnFIE_ps_woodham_calc_light_ring-albedo.tiff", _ hdst_albedo, f_tiff_compression.F_TIFF_COMPRESSION_DEFLATE, -1) ' 光源ベクトルの情報: (slant) Console.Write("slant = ") For i As Integer = 0 To channels - 1 Console.Write("{0} ", slant(i)) Next Console.WriteLine("") ' 光源ベクトルの情報: (tilt) Console.Write("tilt = ") For i As Integer = 0 To channels - 1 Console.Write("{0} ", tilt(i)) Next Console.WriteLine("") Finally hsrc.Dispose() hdst_normal.Dispose() hdst_albedo.Dispose() slant.Dispose() tilt.Dispose() End Try End Sub End Class |