指定座標の濃度値取得(補間付き)
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_img_get_subdens( FHANDLE himg, double x, double y, f_sampling_mode mode, DOUBLE_PTR dens ) |
Visual Basic |
---|
Public Shared Function fnFIE_img_get_subdens ( himg As FHANDLE, x As Double, y As Double, mode As f_sampling_mode, dens As DOUBLE_PTR ) As Integer |
Parameters
- himg
- Type: fvalgcli..::..FHANDLE
濃度を取得する画像( type: bin, uc8, s16, us16, i32, ui32, rgbq, rgbtri, double, float )
- x
- Type: System..::..Double
対象画素のX座標
- y
- Type: System..::..Double
対象画素のY座標
- mode
- Type: fvalgcli..::..f_sampling_mode
補間モード- F_SAMPLING_NN :最近傍法
- F_SAMPLING_BILINEAR :共一次線形補間法(bin画像は指定不可)
- F_SAMPLING_CUBIC :3次畳み込み法(bin画像は指定不可)
- dens
- Type: fvalgcli..::..DOUBLE_PTR
濃度値配列。
himg のチャネル数分のサイズが必用。
RGBQUAD型の場合は3以上のサイズが必要。
Return Value
Type: Int32以下のエラーコードを返します。
エラーコード:
f_err | 内容 |
---|---|
F_ERR_NONE | 正常終了 |
F_ERR_NOMEMORY | メモリ不足エラー |
F_ERR_INVALID_IMAGE | 画像オブジェクトの異常 |
F_ERR_INVALID_PARAM | パラメータ異常 |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Examples
C# | Copy |
---|---|
// $Revision: 1.1 $ using System; using System.Collections.Generic; using System.Text; using fvalgcli; namespace TC { public partial class FIE { /// <summary> /// 指定座標の濃度値取得(補間付き). /// </summary> [FvPluginExecute] public void fnFIE_img_get_subdens() { int status = (int)f_err.F_ERR_NONE; FHANDLE himg = FHANDLE.Zero; // 処理画像. DOUBLE_PTR dens = DOUBLE_PTR.Zero; // 濃度値配列. const int target_x = 10; const int target_y = 20; const f_sampling_mode mode = f_sampling_mode.F_SAMPLING_BILINEAR; // 補間モード const double dens_ans = 30; try { // 処理画像の生成. { himg = api.fnFIE_img_root_alloc((int)f_imgtype.F_IMG_UC8, 1, target_x * 2, target_y * 2); api.fnFIE_img_clear(himg, 0); api.fnFIE_img_set_dens(himg, 0, target_x, target_y, dens_ans); } dens = DOUBLE_PTR.alloc(api.fnFIE_img_get_channels(himg)); // 処理実行. status = api.fnFIE_img_get_subdens(himg, target_x, target_y, mode, dens); Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status); // 結果確認. Assert.IsTrue(dens[0] == dens_ans, "期待値と一致しません"); } finally { himg.Dispose(); dens.Dispose(); } } } } |
Visual Basic | Copy |
---|---|
' $Revision: 1.1 $ Imports System.Collections.Generic Imports System.Text Imports fvalgcli Public Partial Class FIE ''' <summary> ''' 指定座標の濃度値取得(補間付き). ''' </summary> <FvPluginExecute> _ Public Sub fnFIE_img_get_subdens() Dim status As Integer = CInt(f_err.F_ERR_NONE) Dim himg As FHANDLE = FHANDLE.Zero ' 処理画像. Dim dens As DOUBLE_PTR = DOUBLE_PTR.Zero ' 濃度値配列. Const target_x As Integer = 10 Const target_y As Integer = 20 Const mode As f_sampling_mode = f_sampling_mode.F_SAMPLING_BILINEAR ' 補間モード Const dens_ans As Double = 30 Try ' 処理画像の生成. If True Then himg = api.fnFIE_img_root_alloc(CInt(f_imgtype.F_IMG_UC8), 1, target_x * 2, target_y * 2) api.fnFIE_img_clear(himg, 0) api.fnFIE_img_set_dens(himg, 0, target_x, target_y, dens_ans) End If dens = DOUBLE_PTR.alloc(api.fnFIE_img_get_channels(himg)) ' 処理実行. status = api.fnFIE_img_get_subdens(himg, target_x, target_y, mode, dens) Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err)) ' 結果確認. Assert.IsTrue(dens(0) = dens_ans, "期待値と一致しません") Finally himg.Dispose() dens.Dispose() End Try End Sub End Class |