0个粉丝

4

问答

0

专栏

0

资料

 发布于  2026-05-11 14:29:00
采纳率 0%
4个问答
285

hisi3519的ss_mpi_ive_hog函数调用出错

   

有没有大佬用过hisi3519的ss_mpi_ive_hog函数,没有找到具体例程,参照其他ive函数的例程对其进行调用,一直报错handle(-1)

我来回答
回答7个
时间排序
认可量排序

UncleRoderick

69个粉丝

20

问答

6

专栏

20

资料

UncleRoderick 2026-05-11 18:48:17
认可0

没用过这个接口,把你的代码流程贴一下,还有就是handle取值多少?

  回复   UncleRoderick  2026-05-12 09:59:22
0

int main(int argc, char **argv)
{
struct timeval start_time, end_time;

td_s32 ret;
//mpi 初始化 记得加
ret = ss_mpi_sys_init();
if (ret != 0)
{
    sample_print("ss_mpi_sys_init failed with 0x%x!\n", ret);
    return 0;
}

ot_sample_ive_hog_info hog_info = {0};
sample_ive_hog_init(hog_info, 1920, 1080);

……
}

td_void sample_ive_hog_uninit(ot_sample_ive_hog_info *hog_info)
{
sample_svp_mmz_free(hog_info->src.phys_addr[0], hog_info->src.virt_addr[0]);
sample_svp_mmz_free(hog_info->dst.phys_addr, hog_info->dst.virt_addr);
}

td_void sample_ive_hog_init(ot_sample_ive_hog_info &hog_info, td_u32 width, td_u32 height)
{
td_s32 ret;
(td_void)memset_s(&hog_info, sizeof(ot_sample_ive_hog_info), 0, sizeof(ot_sample_ive_hog_info));

hog_info.ctrl.csc_mode = OT_IVE_CSC_MODE_VIDEO_BT709_YUV_TO_RGB;
hog_info.ctrl.hog_mode = OT_IVE_HOG_MODE_VER_TANGENT_PLANE;
hog_info.ctrl.ror_num = 1;
//hog_info.ctrl.norm_trunc_alfa = (td_u4q12)OT_SAMPLE_IVE_KCF_NORM_TRUNC_ALFA;
hog_info.ctrl.norm_trunc_alfa = HOG_NORM_TRUNC_ALFA;

hog_info.dst.dtype = OT_SVP_BLOB_TYPE_U16;
hog_info.dst.stride = 32;
hog_info.dst.num = 1;
int feat_w = std::min(136, 64) / 4 - 2;
int feat_h = std::min(136, 64) / 4 - 2;
hog_info.dst.shape.whc.width = feat_w;
hog_info.dst.shape.whc.height = feat_h;
hog_info.dst.shape.whc.chn = 31;

ret = sample_common_ive_create_image(&hog_info.src, OT_SVP_IMG_TYPE_YUV420SP, width, height);
sample_svp_check_exps_goto(ret != TD_SUCCESS, fail, SAMPLE_SVP_ERR_LEVEL_ERROR, "Error,create src img failed!\n");

ss_mpi_sys_mmz_alloc_cached((td_phys_addr_t *)(&(hog_info.dst.phys_addr)), (void **)(&(hog_info.dst.virt_addr)),
    TD_NULL, TD_NULL, 2 * hog_info.dst.stride * feat_h * 31);

fail:
sample_ive_hog_uninit(&hog_info);
}

// Obtain sub-window from image, with replication-padding and extract features
cv::Mat KCFTracker::getFeatures(const cv::Mat & image, ot_sample_ive_hog_info *hog_info, bool inithann, float scale_adjust)
{
cv::Rect extracted_roi;
ot_ive_handle handle;

float cx = _roi.x + _roi.width / 2;
float cy = _roi.y + _roi.height / 2;

if (inithann) { ... }

extracted_roi.width = scale_adjust * _scale * _tmpl_sz.width;
extracted_roi.height = scale_adjust * _scale * _tmpl_sz.height;

extracted_roi.x = cx - extracted_roi.width / 2;
extracted_roi.y = cy - extracted_roi.height / 2;

cv::Mat FeaturesMap;
cv::Mat z = RectTools::subwindow(image, extracted_roi, cv::BORDER_REPLICATE);

if (z.cols != _tmpl_sz.width || z.rows != _tmpl_sz.height) {
    cv::resize(z, z, _tmpl_sz);
}

cv::Mat yuvImg;
BGR2YUV_nv21(image, yuvImg);

td_u32 img_w = image.cols;
td_u32 img_h = image.rows;

ot_svp_src_img *img_info = (ot_svp_src_img *)malloc(sizeof(ot_svp_src_img));
unsigned char *temp = (unsigned char *)malloc(sizeof(unsigned char) * yuvImg.cols * yuvImg.rows); // 现在按照YUV420 数据量来 W不变
memcpy(temp, yuvImg.data, yuvImg.cols * yuvImg.rows);

img_info->virt_addr[0] = (td_u64)temp;
// 这个地方需要给原图像的高、宽
img_info->width = img_w;
img_info->height = img_h;
ot_svp_img src1;
memset(&src1, 0, sizeof(ot_svp_img));
sample_common_ive_create_image(&src1, OT_SVP_IMG_TYPE_YUV420SP, img_w, img_h); // 这个函数就可以创建一个 ot_svp_img, 含有物理和虚拟地址
sample_common_ive_read_file(&src1, img_info);
//将img_input 到 src1
// sample_common_ive_read_file(&hog_info->src, img_info);

hog_info->roi.x = extracted_roi.x;
hog_info->roi.y = extracted_roi.y;
hog_info->roi.width = 64;
hog_info->roi.height = 64;

// HOG features
if (_hogfeatures) {
    CvLSVMFeatureMapCascade *map;

    ss_mpi_ive_hog(&handle, &src1, &hog_info->roi, &hog_info->dst, &hog_info->ctrl, TD_FALSE);
    sample_ive_kcf_query_task(handle);

    // if(z.channels() == 3){
    //     DlibGetFeatureMaps_BGR(z, cell_size, &map);
    // } else{
    //     DlibGetFeatureMaps(z, cell_size, &map);
    // }
   ......

}

UncleRoderick
UncleRoderick   回复    2026-05-12 13:46:55
0

在KCFTracker::getFeatures里面把ot_ive_handle handle;改成ot_ive_handle handle = 0;试试

  回复   UncleRoderick  2026-05-12 15:09:58
0

改为ot_ive_handle handle = 0;后还是报这个错,报错信息如下:
[MPP] Version: [HI3519DV500_MPP_V2.0.2.0 B050 Release], Build Time[Dec 20 2024, 16:23:07]
3.4.200
[Func]:ot_mpi_ive_query [Line:493] [Info]:handle(-1) is invalid

另外还想请教一下您,我这边调用ive的流程是正确的吗

UncleRoderick
UncleRoderick   回复    2026-05-12 16:35:04
0

可以试试整个流程的handle参数都打印下看看

  回复   UncleRoderick  2026-05-12 17:25:53
0

这个流程中只有调用ss_mpi_ive_hog函数时才用到了handle

UncleRoderick
UncleRoderick   回复    2026-05-12 19:05:10
0

sample_ive_kcf_query_task的时候不行也用到了吗?

或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区