Hi
Is this correct in converting any image to grayscale? Depending on what rotation I do the for loop? The image is affected which I know it’s working but I think it’s just the calculation.
Vivienne
I’m trying the first method tannerhelland.com/3643/grays … rithm-vb6/
[code]{
// create temporary area
unsigned char * tempdata_ = new unsigned char[width_ * height_ * depth_*components_];
unsigned char grey;
// loop
for(unsigned width=0; width<width_;width++)
{
for(unsigned height=0; height<height_;height++)
{
grey=(data_[(width*height)+0]+data_[(width*height)+1]+data_[(width*height)+2])/3;
tempdata_[(width*height)+0]=grey;
tempdata_[(width*height)+1]=grey;
tempdata_[(width*height)+2]=grey;
}
}
// copy data
memcpy(data_, tempdata_, width_*height_*depth_*components_);
return;
}[/code]