ルックアップテーブルによる濃度変換フィルタ(チャンネル別)
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_lut_convert_ch(
FHANDLE hSrc,
FHANDLE hDst,
INT_PTR[] ppiConvertTable,
uint uiTableSize
) |
Visual Basic |
---|
Public Shared Function fnFIE_lut_convert_ch (
hSrc As FHANDLE,
hDst As FHANDLE,
ppiConvertTable As INT_PTR(),
uiTableSize As UInteger
) As Integer |
Return Value
Type:
Int32
以下のエラーコードを返します。
エラーコード:f_err | 内容 |
---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_IMAGE | 不正な画像が渡された |
F_ERR_INVALID_PARAM | 不正なパラメータが渡された |
F_ERR_NOMEMOY | メモリ不足エラー |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Examples
C# | Copy |
---|
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnFIE_lut_convert_ch()
{
int status = (int)f_err.F_ERR_NONE;
FHANDLE hsrc1 = FHANDLE.Zero;
FHANDLE hdst = FHANDLE.Zero;
INT_PTR itable = IntPtr.Zero;
INT_PTR[] tables = null;
try
{
api.fnFIE_load_img_file(TestImageDir + "/testdata/gray_04.bmp", ref hsrc1, f_color_img_type.F_COLOR_IMG_TYPE_UC8);
int width = api.fnFIE_img_get_width(hsrc1);
int height = api.fnFIE_img_get_height(hsrc1);
int channels = api.fnFIE_img_get_channels(hsrc1);
int type = api.fnFIE_img_get_type(hsrc1);
hdst = api.fnFIE_img_root_alloc(type, channels, width, height);
tables = new INT_PTR[channels];
int table_size = 0;
switch ((f_imgtype)type)
{
default:
case f_imgtype.F_IMG_UC8:
case f_imgtype.F_IMG_RGBQUAD:
table_size = defs.UC8_MAX + 1;
break;
case f_imgtype.F_IMG_US16:
case f_imgtype.F_IMG_S16:
table_size = defs.US16_MAX + 1;
break;
}
for (int ch = 0; ch < channels; ch++)
{
tables[ch] = INT_PTR.alloc(table_size);
for (int i = 0; i < table_size; ++i)
tables[ch][i] = table_size - i;
}
status = api.fnFIE_lut_convert_ch(hsrc1, hdst, tables, (uint)table_size);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
api.fnFIE_save_png(ResultDir + "/fnFIE_lut_convert_ch.png", hdst, -1);
}
finally
{
hsrc1.Dispose();
hdst.Dispose();
for (int ch = 0; ch < tables.Length; ch++)
tables[ch].Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports System.Runtime.InteropServices
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_lut_convert_ch()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim hsrc1 As FHANDLE = FHANDLE.Zero
Dim hdst As FHANDLE = FHANDLE.Zero
Dim itable As INT_PTR = IntPtr.Zero
Dim tables As INT_PTR() = Nothing
Try
api.fnFIE_load_img_file(TestImageDir & "/testdata/gray_04.bmp", hsrc1, f_color_img_type.F_COLOR_IMG_TYPE_UC8)
Dim width As Integer = api.fnFIE_img_get_width(hsrc1)
Dim height As Integer = api.fnFIE_img_get_height(hsrc1)
Dim channels As Integer = api.fnFIE_img_get_channels(hsrc1)
Dim type As Integer = api.fnFIE_img_get_type(hsrc1)
hdst = api.fnFIE_img_root_alloc(type, channels, width, height)
tables = New INT_PTR(channels - 1) {}
Dim table_size As Integer = 0
Select Case CType(type, f_imgtype)
Case f_imgtype.F_IMG_UC8
table_size = defs.UC8_MAX + 1
Exit Select
Case f_imgtype.F_IMG_RGBQUAD
table_size = defs.UC8_MAX + 1
Exit Select
Case f_imgtype.F_IMG_US16
table_size = defs.US16_MAX + 1
Exit Select
Case f_imgtype.F_IMG_S16
table_size = defs.US16_MAX + 1
Exit Select
End Select
For ch As Integer = 0 To channels - 1
tables(ch) = INT_PTR.alloc(table_size)
For i As Integer = 0 To table_size - 1
tables(ch)(i) = table_size - i
Next
Next
status = api.fnFIE_lut_convert_ch(hsrc1, hdst, tables, CUInt(table_size))
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
api.fnFIE_save_png(ResultDir & "/fnFIE_lut_convert_ch.png", hdst, -1)
Finally
hsrc1.Dispose()
hdst.Dispose()
For ch As Integer = 0 To tables.Length - 1
tables(ch).Dispose()
Next
End Try
End Sub
End Class |
See Also