| | |
extrapolate an image
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2005
Posts: 5
Reputation:
Solved Threads: 0
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
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
•
•
•
•
Originally Posted by koteeswara
now please do send me a C++ program which can read an image into a matrix and display the same.
Alex Cavnar, aka alc6379
•
•
Join Date: Jan 2005
Posts: 5
Reputation:
Solved Threads: 0
thankyou for the suggestion dear sir/madam!
i am trying to read the image with fread() command in c.
koteeswara
i am trying to read the image with fread() command in c.
koteeswara
•
•
•
•
Originally Posted by alc6379
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.
•
•
Join Date: Jan 2005
Posts: 5
Reputation:
Solved Threads: 0
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[i][j]=getc(fp);
if(a[i][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[i][j],fp);
}
fclose(fp);
for(i=0;i<41;i++)
for(j=0;j<41;j++)
{printf(" %d",a[i][j]);
j++;}
printf("\n");
}
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[i][j]=getc(fp);
if(a[i][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[i][j],fp);
}
fclose(fp);
for(i=0;i<41;i++)
for(j=0;j<41;j++)
{printf(" %d",a[i][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...
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...
http://sales.carina-e.com
no www
no nonsense
coming soon to a pc near you! :cool:
no www
no nonsense
coming soon to a pc near you! :cool:
![]() |
Similar Threads
- News Story: Google Begins Experimenting with Image Recognition (Search Engine Optimization)
Other Threads in the C Forum
- Previous Thread: syntax error? .. operator overload method problemo
- Next Thread: Inputting from files
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays asterisks binarysearch calculate changingto char character cm command copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic execv feet fgets file fork forloop framework function functions givemetehcodez grade graphics gtkwinlinux hacking histogram homework include incrementoperators input intmain() iso kernel keyboard km lazy license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft motherboard mqqueue number oddnumber odf opensource overwrite owf pdf performance pointer posix problem probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket socketprograming spoonfeeding standard string student systemcall testing threads turboc unix user variable wab whythiscodecausesegmentationfault windowsapi






