hi all !
please let me know how to extrapolate a 2D image to expand it.
thanking you in advance.

Recommended Answers

All 8 Replies

Hello,

This question is similar in concept to building a pyramid.

You might want to expand on what you are trying to do first.

Christian

Hello Christian!
thankyou for reply. i am working on Visualization Tool Kit, my project is "volume rendering of 2D mri images to get 3D object using vtk". i got found one formula for extraploation in the following website http://www.sgi.com/misc/grafica/interp/. now please do send me a C++ program which can read an image into a matrix and display the same.
koteeswara

now please do send me a C++ program which can read an image into a matrix and display the same.

Not trying to be rude, but I believe that's what you pay someone to do. We're here to help you learn how to code, not write programs for you. Attempt to write something on your own, and we'll help you hash it out.

thankyou for the suggestion dear sir/madam!
i am trying to read the image with fread() command in c.
koteeswara

Not trying to be rude, but I believe that's what you pay someone to do. We're here to help you learn how to code, not write programs for you. Attempt to write something on your own, and we'll help you hash it out.

Have you successfully read in the image yet? That is the first hurdle. Then the extrapolation should be clear.

dear sir/madam!
i am not yet successful in reading the image. i am working on it
koteeswara

this is the c program by which i can read the image store the image in a matrix and display the image as well. at last i was successful in reading jpeg giff and bmp images.
koteeswara.
#include<stdio.h>
main()
{
FILE *fp;
int a[1024][1024];
int i=0,j=0,k;
fp=fopen("tsunami_guillemin.jpg","rb");
if(fp==NULL)
{
puts("cannot open file");
//exit();
}
while(1)
{
for(i=0;i<1024;i++)
for(j=0;j<1024;j++)
a[j]=getc(fp);
if(a[j]=EOF)
break;
i++;j++;
}
fclose(fp);
fp=fopen("example2.bmp","wb");
for(i=0;i<1024;i++)
for(j=0;j<1024;j++)
{
putc(a[j],fp);
}
fclose(fp);
for(i=0;i<41;i++)
for(j=0;j<41;j++)
{printf(" %d",a[j]);
j++;}
printf("\n");
}

Im not too keen on the one-size matrix [1024][1024]. It would make more sense to get the Bitmap's width and Height from the BMP file. Doing a google search for the file fomat (Bitmap File format) should help -> Bear in mind there are MANY Win32 API functions/structures to handle and load bitmaps correctly...

If you can get the BM width height ect... then instead of loading the WHOLE file in (as your code does) you can just load the pixel data, which is what you need to extrapolate. The file format / API docs will help with getting the info from the file header ect...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.