accessing pixel image c++
Hi there,
cv::Mat depth_clean(cv_depthptr->image.rows, cv_depthptr->image.cols, CV_32FC1);
cv::Mat img(cv_depthptr->image.rows, cv_depthptr->image.cols, CV_8UC1);
for(int i = 0; i < cv_depthptr->image.rows; i++)
{
float* Di = cv_depthptr->image.ptr<float>(i);
float* Ii = depth_clean.ptr<float>(i);
char* Ivi = img.ptr<char>(i);
for(int j = 0; j < cv_depthptr->image.cols; j++)
{
if(Di[j] > 0.0f){
Ii[j] = Di[j];
Ivi[j] = (char) (255*((Di[j])/(5.5))); // some suitable values..
}
else{
Ii[j] = 0.0f;
Ivi[j] = 0;
}
}
}
Can anyone explain to me using that program how the accessing to the pixel has been done ? using pointer and the two loops and what the different between cv_depthptr->image.ptr<float>(i) and Di[j] ?
Thank you so much