gpt4 book ai didi

c - 使用 CV_MAT_ELEM 修改 CvMat* 像素

转载 作者:太空宇宙 更新时间:2023-11-04 04:51:00 31 4
gpt4 key购买 nike

<分区>

我正在尝试创建一个用于 Filter2D 函数的内核。该函数要求内核采用 CvMat 格式。

如何访问 CvMat 的元素?我有以下代码,它给出了编译器错误。

inline void plot(CvMat* mat, int x, int y, float c)
//plot the pixel at (x, y) with brightness c (where 0 ≤ c ≤ 1)
{
CV_MAT_ELEM(mat,float,y,x) = MIN(c,1); //The error occurs at this line
}

我收到以下错误:

error C2228: left of '.data' must have class/struct/union error C2228: left of '.ptr' must have class/struct/union error C2228: left of '.step' must have class/struct/union

我做错了什么?

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com