色彩特徴量画像の生成(HSV色空間基準)
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_img_hsv_to_gray(
FHANDLE hsrc,
FHANDLE hdst,
double hue_base,
double hue_range,
double sat_low,
double sat_high
) |
Visual Basic |
---|
Public Shared Function fnFIE_img_hsv_to_gray (
hsrc As FHANDLE,
hdst As FHANDLE,
hue_base As Double,
hue_range As Double,
sat_low As Double,
sat_high As Double
) As Integer |
Parameters
- hsrc
- Type: fvalgcli..::..FHANDLE
入力画像のハンドル( channel : 3, type : uc8, s16, us16, float, double, rgbquad, rgbtriple )
- hdst
- Type: fvalgcli..::..FHANDLE
出力画像のハンドル( channel : 1, type : uc8, s16, us16, float, double, rgbquad, rgbtriple )
- hue_base
- Type: System..::..Double
色相基準( 0 ≦ hue_base < 360 )単位:度
- hue_range
- Type: System..::..Double
色相範囲( 0 ≦ hue_range ≦ 180 ) 単位:度
- sat_low
- Type: System..::..Double
彩度下限( 0 ≦ sat_low ≦ 255 )
- sat_high
- Type: System..::..Double
彩度上限( 0 ≦ sat_high ≦ 255 )
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_img_hsv_to_gray()
{
int status = (int)f_err.F_ERR_NONE;
FHANDLE hsrc = FHANDLE.Zero;
FHANDLE hdst = FHANDLE.Zero;
try
{
api.fnFIE_load_img_file(TestImageDir + "/testdata/test_color_extract.bmp", 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 = 1;
int type = api.fnFIE_img_get_type(hsrc);
hdst = api.fnFIE_img_root_alloc(type, channels, width, height);
double hue_base = 50;
double hue_range = 180;
double sat_low = 0;
double sat_high = 255;
status = api.fnFIE_img_hsv_to_gray(hsrc, hdst, hue_base, hue_range, sat_low, sat_high);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
api.fnFIE_save_png(ResultDir + "/fnFIE_img_hsv_to_gray.png", hdst, -1);
}
finally
{
hsrc.Dispose();
hdst.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_img_hsv_to_gray()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim hsrc As FHANDLE = FHANDLE.Zero
Dim hdst As FHANDLE = FHANDLE.Zero
Try
api.fnFIE_load_img_file(TestImageDir & "/testdata/test_color_extract.bmp", 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 = 1
Dim type As Integer = api.fnFIE_img_get_type(hsrc)
hdst = api.fnFIE_img_root_alloc(type, channels, width, height)
Dim hue_base As Double = 50
Dim hue_range As Double = 180
Dim sat_low As Double = 0
Dim sat_high As Double = 255
status = api.fnFIE_img_hsv_to_gray(hsrc, hdst, hue_base, hue_range, sat_low, sat_high)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
api.fnFIE_save_png(ResultDir & "/fnFIE_img_hsv_to_gray.png", hdst, -1)
Finally
hsrc.Dispose()
hdst.Dispose()
End Try
End Sub
End Class |
See Also