EN
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助

Threshold_LT

对图像中的像素与阈值进行比较,小于阈值的设置为阈值。

大于操作,即level是源向量的下边界。计算公式为:

函数接口声明如下:

  • 单通道数据的阈值操作:

    HmppResult HMPPI_Threshold_LT_8u_C1R(const uint8_t* src, int32_t srcStep, uint8_t* dst, int32_t dstStep, HmppiSize roiSize, uint8_t threshold);

    HmppResult HMPPI_Threshold_LT_16u_C1R(const uint16_t* src, int32_t srcStep, uint16_t* dst, int32_t dstStep, HmppiSize roiSize, uint16_t threshold);

    HmppResult HMPPI_Threshold_LT_16s_C1R(const int16_t* src, int32_t srcStep, int16_t* dst, int32_t dstStep, HmppiSize roiSize, int16_t threshold);

    HmppResult HMPPI_Threshold_LT_32f_C1R(const float* src, int32_t srcStep, float* dst, int32_t dstStep, HmppiSize roiSize, float threshold);

  • 多通道数据的阈值操作:

    HmppResult HMPPI_Threshold_LT_8u_C3R(const uint8_t *src, int32_t srcStep, uint8_t*dst, int32_t dstStep, HmppiSize roiSize, const uint8_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_16u_C3R(const uint16_t *src, int32_t srcStep, uint16_t*dst, int32_t dstStep, HmppiSize roiSize, const uint16_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_16s_C3R(const int16_t *src, int32_t srcStep, int16_t*dst, int32_t dstStep, HmppiSize roiSize, const int16_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_32f_C3R(const float *src, int32_t srcStep, float*dst, int32_t dstStep, HmppiSize roiSize, const float threshold[3]);

    HmppResult HMPPI_Threshold_LT_8u_AC4R(const uint8_t *src, int32_t srcStep, uint8_t*dst, int32_t dstStep, HmppiSize roiSize, const uint8_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_16u_AC4R(const uint16_t *src, int32_t srcStep, uint16_t*dst, int32_t dstStep, HmppiSize roiSize, const uint16_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_16s_AC4R(const int16_t *src, int32_t srcStep, int16_t*dst, int32_t dstStep, HmppiSizeroiSize, const int16_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_32f_AC4R(const float *src, int32_t srcStep, float*dst, int32_t dstStep, HmppiSizeroiSize, const float threshold[3]);

  • 单通道数据的原址阈值操作:

    HmppResult HMPPI_Threshold_LT_8u_C1IR(uint8_t *srcDst, int32_t srcDstStep, HmppiSize roiSize, uint8_t threshold);

    HmppResult HMPPI_Threshold_LT_16u_C1IR(uint16_t *srcDst, int32_t srcDstStep, HmppiSize roiSize, uint16_t threshold);

    HmppResult HMPPI_Threshold_LT_16s_C1IR(int16_t *srcDst, int32_t srcDstStep, HmppiSize roiSize, int16_t threshold);

    HmppResult HMPPI_Threshold_LT_32f_C1IR(float *srcDst, int32_t srcDstStep, HmppiSize roiSize, float threshold);

  • 多通道数据的原址阈值操作:

    HmppResult HMPPI_Threshold_LT_8u_C3IR(uint8_t *srcDst, int32_t srcDstStep, HmppiSize roiSize, const uint8_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_16u_C3IR(uint16_t *srcDst, int32_t srcDstStep, HmppiSize roiSize, const uint16_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_16s_C3IR(int16_t *srcDst, int32_t srcDstStep, HmppiSize roiSize, const int16_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_32f_C3IR(float *srcDst, int32_t srcDstStep, HmppiSize roiSize, const float threshold[3]);

    HmppResult HMPPI_Threshold_LT_8u_AC4IR(uint8_t *srcDst, int32_t srcDstStep, HmppiSize roiSize, const uint8_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_16u_AC4IR(uint16_t *srcDst, int32_t srcDstStep, HmppiSize roiSize, const uint16_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_16s_AC4IR(int16_t *srcDst, int32_t srcDstStep, HmppiSize roiSize, const int16_t threshold[3]);

    HmppResult HMPPI_Threshold_LT_32f_AC4IR(float *srcDst, int32_t srcDstStep, HmppiSize roiSize, const float threshold[3]);

参数

参数名

描述

取值范围

输入/输出

src

指向源图像感兴趣区域的指针。

非空。

输入

srcStep

源图像中连续行起点之间的距离(以字节为单位)。

非空。

输入

dst

指向目标图像感兴趣区域的指针。

非空。

输出

dstStep

目标图像中连续行的起点之间的距离(以字节为单位)。

大于0。

输入

srcDst

指向源和目标图像感兴趣区域的指针(用于原址操作)。

非空。

输入/输出

srcDstStep

原址操作的源图像和目标图像中连续行起点之间的距离(以字节为单位)。

大于0。

输入

roiSize

源和目标图像感兴趣区域的大小(以像素为单位)。

roiSize.width∈(0, INT_MAX],roiSize.height∈(0, INT_MAX]

输入

threshold

每个像素要使用的阈值水平值;多通道数据下,使用每个颜色通道的阈值数组。

任意值。

输入

返回值

  • 成功:返回HMPP_STS_NO_ERR
  • 失败:返回错误码。

错误码

错误码

描述

HMPP_STS_NULL_PTR_ERR

src、dst、srcDst中存在空指针。

HMPP_STS_SIZE_ERR

roiSize的width、height存在零或负值。

HMPP_STS_STEP_ERR

srcStep、dstStep、srcDstStep中存在零或负值。

HMPP_STS_NOT_EVEN_STEP_ERR

srcStep、dstStep不能被src、dst所属数据类型的字节长度整除的错误条件。

HMPP_STS_ROI_ERR

roiSize.width大于步长。

示例

#define BUFFER_SIZE_T 52

int ThresholdLTExample(){
    HmppiSize roi = {4,3};
    uint8_t src[BUFFER_SIZE_T] = {  1, 4, 8, 13, 16, 20, 24, 28, 32, 36, 40, 44, 48, 
                                    1, 4, 8, 13, 16, 20, 24, 28, 32, 36, 40, 44, 48, 
                                    1, 4, 8, 13, 16, 20, 24, 28, 32, 36, 40, 44, 48, 
                                    1, 4, 8, 13, 16, 20, 24, 28, 32, 36, 40, 44, 48};
    uint8_t dst[BUFFER_SIZE_T] = {0};
    uint8_t threshold[3] = {18,30,35};
    int32_t srcStep=13*sizeof(uint8_t);
    int32_t dstStep=13*sizeof(uint8_t);
    HmppResult result = HMPPI_Threshold_LT_8u_C3R(src, srcStep, dst, dstStep, roi, threshold);
    printf("result = %d \ndst =", result);
    if (result != HMPP_STS_NO_ERR) {
        return;
    }
    for (int i = 0; i < 4; i++){
        for (int j = 0; j < 13; j++){
            printf("%4d ", dst[i * 13 + j]);
        }
        printf("\n");
    }
       return 0;
}

运行结果:

result = 0
dst = 18 30 35 18 30 35 24 30 35 36 40 44 0
      18 30 35 18 30 35 24 30 35 36 40 44 0
      18 30 35 18 30 35 24 30 35 36 40 44 0
       0  0  0  0  0  0  0  0  0  0  0  0 0