Can i print the values of pixels in the type pixelwand **pixels..?
My code is
Code: Select all
void subimages_pxls(MagickWand *wand,size_t sbimg_wdt,size_t sbimg_hgt)
{
size_t width=MagickGetImageWidth(wand);
size_t height=MagickGetImageHeight(wand);
int n_sbimg=(width/sbimg_wdt)*(height/sbimg_hgt);
printf("\nNo of Sub Images : %d\n",n_sbimg);
int i,j,k=0;
size_t row[n_sbimg],col[n_sbimg];
for(i=0;i<height;i=i+sbimg_hgt)
{
for(j=0;j<width;j=j+sbimg_wdt)
{
row[k]=i;
col[k]=j;
k++;
}
}
PixelIterator * rg_itr;
PixelWand ** pixels;
int n,
t=(sbimg_wdt*sbimg_hgt)*n_sbimg;
int * p;
p=(int*)malloc(t*sizeof(int));
i=0;
for(n=0;n<n_sbimg;n++)
{
rg_itr=NewPixelRegionIterator(wand,col[n],row[n],sbimg_wdt,sbimg_hgt);
for (y=0; y<sbimg_hgt; y++)
{
pixels = PixelGetNextIteratorRow(rg_itr, &sbimg_wdt);
for (x=0;x<sbimg_wdt; x++,i++)
{
p[i]=(int)*pixels;
}
}
}
for(n=0;n<(sbimg_wdt*sbimg_hgt)*n_sbimg;n++)
{
printf("pixels %d : %d\n",n,p[n]);
}
}