I'm trying to get an array of pixel intensities for an image with ImageMagick in C++ via Magick++.
I found out how to do it in Perl:
Code: Select all
@pixels = $image->GetPixels(map=>'I', height=>$height, width=>$width, normalize=>true);
Code: Select all
@pixels = $image->GetPixels(map=>'I', height=>$height, width=>$width, normalize=>true);
Code: Select all
Image img("test.jpg");
Geometry geo(640,480);
img.scale(geo);
img.blur(1,0.5);
double *pixels = new double[640*480];
image.write( 0, 0, 640, 480, "I", DoublePixel, pixels );
Code: Select all
char *pixels = new char[width*height];
image.write( 0, 0, width, height, "I", CharPixel, pixels );
Code: Select all
unsigned int *pixels = new unsigned int[width*height];
image.write( 0, 0, width, height, "I", IntegerPixel, pixels );
Code: Select all
unsigned char *pixels = new unsigned char[width*height];
image.write( 0, 0, width, height, "I", CharPixel, pixels );