simple-iphone-image-processing源码问题,这是做什么的
我正在查看上述项目的源代码,但我不明白以下代码行,有人可以帮我解释一下吗?我正在尝试让代码处理彩色图像,因为它目前仅适用于灰度图像。我有主要的方法,但是过滤器仅应用于返回图像的前四分之一。
//在辅助文件中。
inline uint8_t* operator[](const int rowIndex) {
return m_yptrs[rowIndex];
}
//在.mm文件中
void Image::initYptrs() {
m_yptrs=(uint8_t **) malloc(sizeof(uint8_t *)*m_height);
for(int i=0; i<m_height; i++) {
m_yptrs[i]=m_imageData+i*m_width;
}
}
根据我的理解,它看起来像是在创建对图像中像素的引用,但是我不理解这行代码。
m_yptrs[i]=m_imageData+i*m_width;
提前致谢。
I am going through the source code for the above project and I don't understand the following lines of code can anyone help explain it to me please? I am trying to get the code to work with color images as it currently only works with greyscale images. I have the main methods working however the filters only get applied to the top quarter of the returned images.
//In the heeder file.
inline uint8_t* operator[](const int rowIndex) {
return m_yptrs[rowIndex];
}
//in the .mm file
void Image::initYptrs() {
m_yptrs=(uint8_t **) malloc(sizeof(uint8_t *)*m_height);
for(int i=0; i<m_height; i++) {
m_yptrs[i]=m_imageData+i*m_width;
}
}
From my understanding it looks like it is creating a a reference to the pixels in the images however i don't understand this line of code.
m_yptrs[i]=m_imageData+i*m_width;
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Image::initYptrs()
初始化指向图像每行开头的指针数组。有问题的行可能应该是
“其中 BPP 是每个像素的字节数”(例如,RGB 为 3,RGBA 图像为 4)。
Image::initYptrs()
initializes an array of pointers to the beginning of each row of the image.The line in question should probably read
Where BPP is bytes per pixel (e.g. 3 for RGB, 4 for RGBA images).