salt-and-pepper noise 付加フィルタ
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_add_noise_salt_and_pepper(
FHANDLE hSrc,
FHANDLE hDst,
double salt_rate,
double salt_val,
double pepper_rate,
double pepper_val,
uint seed
) |
Visual Basic |
---|
Public Shared Function fnFIE_add_noise_salt_and_pepper (
hSrc As FHANDLE,
hDst As FHANDLE,
salt_rate As Double,
salt_val As Double,
pepper_rate As Double,
pepper_val As Double,
seed As UInteger
) As Integer |
Parameters
- hSrc
- Type: fvalgcli..::..FHANDLE
処理対象画像( type: bin, uc8, s16, us16, double )
- hDst
- Type: fvalgcli..::..FHANDLE
処理結果画像( type: bin, uc8, s16, us16, double )
- salt_rate
- Type: System..::..Double
saltの割合( 0.0≦ salt_rate ≦1.0, salt_rate + pepper_rate ≦ 1.0 )
- salt_val
- Type: System..::..Double
saltの値( pepper_val < salt_val )
- pepper_rate
- Type: System..::..Double
pepperの割合( 0.0 ≦ pepper_rate ≦ 1.0, salt_rate + pepper_rate ≦ 1.0 )
- pepper_val
- Type: System..::..Double
pepperの値( pepper_val < salt_val )
- seed
- Type: System..::..UInt32
擬似乱数ジェネレータの初期シード値
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 |
---|
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnFIE_add_noise_salt_and_pepper()
{
int status = (int)f_err.F_ERR_NONE;
FHANDLE hsrc1 = FHANDLE.Zero;
FHANDLE hdst = FHANDLE.Zero;
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);
status = api.fnFIE_add_noise_salt_and_pepper(hsrc1, hdst, 0.25, 255, 0.25, 0, 523532);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
api.fnFIE_save_png(ResultDir + "/fnFIE_add_noise_salt_and_pepper.png", hdst, -1);
}
finally
{
hsrc1.Dispose();
hdst.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_add_noise_salt_and_pepper()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim hsrc1 As FHANDLE = FHANDLE.Zero
Dim hdst As FHANDLE = FHANDLE.Zero
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)
status = api.fnFIE_add_noise_salt_and_pepper(hsrc1, hdst, 0.25, 255, 0.25, 0, _
523532)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
api.fnFIE_save_png(ResultDir & "/fnFIE_add_noise_salt_and_pepper.png", hdst, -1)
Finally
hsrc1.Dispose()
hdst.Dispose()
End Try
End Sub
End Class |
See Also