1 | initial version |
I think you need to understand previous answer and it is not difficult to do it with pointer access. I haven't test following lines :
int i,j;
uchar* p;
for( i = 0; i < nRows; ++i)
{
p = I.ptr<uchar>(i)+i;
for ( j = i; j < nCols; ++j,p++)
{
*p = table[*p];
}
}
int i,j;
uchar* p;
for( i = 0; i < nCols; ++i)
{
p = I.ptr<uchar>(i)+i+1;
for ( j = i+1; j < nRows; ++j,p+=nCols)
{
*p = table[*p];
}
}
int i,j;
uchar* p=I.ptr<uchar>(i);
for( i = 0; i < min(nCols,nRows); ++i,p+=nCols+1)
{
*p = table[*p];
}
2 | No.2 Revision |
I think you need to understand previous answer and it is not difficult to do it with pointer access. I haven't test following lines :(Mat i must be continuous):
int i,j;
uchar* p;
for( i = 0; i < nRows; ++i)
{
p = I.ptr<uchar>(i)+i;
for ( j = i; j < nCols; ++j,p++)
{
*p = table[*p];
}
}
int i,j;
uchar* p;
for( i = 0; i < nCols; ++i)
{
p = I.ptr<uchar>(i)+i+1;
for ( j = i+1; j < nRows; ++j,p+=nCols)
{
*p = table[*p];
}
}
int i,j;
uchar* p=I.ptr<uchar>(i);
for( i = 0; i < min(nCols,nRows); ++i,p+=nCols+1)
{
*p = table[*p];
}