Graphics Reference
In-Depth Information
j=2*p;
for (i=1; i < =p; i++)
{
++j;
y[j]=x3[i];
j=3*p;
for (i=1; i < p; i++)
{
++j;
y[j]=x4[i];
l++;
p=(int)pow(4.0,(double)l);
for (i=1; i < p; i++)
x2[i]=y[i];
}
Thus, we see for a fixed resolution, the program fragment provides a repre-
sentation of the Hilbert curve in terms of 4-connected chain codes. This chain
codes provide the scan directions in an image for the corresponding Hilbert
image. Below, we show how the Hilbert scanned image can be obtained.
/*————pixel arrangement according to H-scan——————*/
/* pixel can be arranged using the coded Hilbert curve or its mirror */
/* image. Below we give one example.——————————-*/
/* Array y contains the Hilbert image for an image in img array.——*/
i=1; j=1;
y[1]=img[i][j];
for (k1=1; k1 < p; k1++)
{
if (x2[k1] ==1)
i=i+1;
if (x2[k1] ==2)
j=j+1;
if (x2[k1] ==3)
i=i-1;
if (x2[k1] ==4)
j=j-1;
y[k1+1]=img[i][j];
} The inverse mapping of the Hilbert scanned image is straightforward. We
have the 1-d Hilbert scanned image and the corresponding 4-connected chain
codes. From these two factors, one can quickly get back the original image.
Search WWH ::




Custom Search