I was trying to use draw a gradient image(kind of gimp style) using "step". But the result turn out to be wrong. Could anyone give me some hints ?
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
Mat img;
Scalar a = 0;
img = Mat(32, 32, CV_8UC1, a);
unsigned char *p;
for(int i=0; i<img.rows; i++)
{
p = img.data + i*img.step[0];
for(int j=0; j<img.cols; j++, p++)
{
*p = j;
}
}
imwrite("gradient.png", img);
return 0;
}