extract of an image (array)
- From: christina.goerner@xxxxxx (Crissy)
- Date: 4 Apr 2005 08:43:42 -0700
Hi!
I´m a bloody beginner concerning programming...
I have an image data file (.pgm) which consits of a header (=record
1) and a gray scale image in 10 bit format (0-1023 values)(=record 2).
The header contains some information about the image size (3712*3712
pixels) and the data source. Now I want to extract a piece (2000*712
pixels) of this image.
This is the program a have so far:
-------------------------------------------------------------------------------
program europa_extrahieren
character(256) :: name_IN =
"C:\MSG-1\Images\HRIT\200407161200-msg-ch01.pgm"
character(256) :: name_OUT =
"C:\MSG-1\Images\Europa\200407161200-msg-ch01.pgm"
integer :: pixels = 3712
integer :: lines = 3712
integer :: x, y
integer :: stat, stato
integer(2), Dimension (:,:), Allocatable :: array_bild, array_europa
character(120) :: header
allocate (array_bild(1:pixels,1:lines))
allocate (array_europa(500:2500, 3000:lines))
open(1, file=name_IN, RECL=120, FORM='BINARY', ACCESS='DIRECT',
CONVERT='BIG_ENDIAN', iostat=stato)
open(2, file=name_OUT, RECL=120, FORM='BINARY', ACCESS='DIRECT',
CONVERT='BIG_ENDIAN', iostat=stato)
read (1,REC=1,iostat=stat) header
read (1,REC=2,iostat=stat) array_bild
write (2, REC=1, FMT='(A)') header
do y=3000,pixels
do x=0,800
write (2, REC=2, FMT='(I4,I4)') x, y
end do
end do
close (1)
close (2)
deallocate (array_europa)
deallocate (array_bild)
end program europa_extrahieren
--------------------------------------------------------------------------
It doesn't work - as I expected. What's wrong???
Thanks for helping me!!!
Crissy
.
- Follow-Ups:
- Re: extract of an image (array)
- From: andy2O
- Re: extract of an image (array)
- From: Michael Metcalf
- Re: extract of an image (array)
- Prev by Date: Re: Free Fortran compiler that handles Cray-style pointers available?
- Next by Date: Re: Little question about FORTRAN programming
- Previous by thread: Switch for PGI to accept arbitrary filname extensions?
- Next by thread: Re: extract of an image (array)
- Index(es):
Relevant Pages
|
|