extract of an image (array)



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
.



Relevant Pages

  • RE: extract of an image (array)
    ... >I have an image data file which consits of a header (=record ... >The header contains some information about the image size (3712*3712 ... >pixels) and the data source. ...
    (comp.lang.fortran)
  • Re: extract of an image (array)
    ... I have an image data file which consits of a header (=record ... The header contains some information about the image size (3712*3712 ... pixels) and the data source. ...
    (comp.lang.fortran)
  • Re: How do I setup a repeating table header in Word that marks tab
    ... You don't really need to defend Microsoft to me. ... I just think that they should provide this VERY USEFUL feature (if ... pixels on a page, number of pixels down from the top of the page for the ... line spacing, header rows, merged rows, etc. ...
    (microsoft.public.office.developer.vba)
  • Re: HP 49G+ Display [TrigLib bug]
    ... it overwrites the header and leaves garbled pixels ... when the standard font height is either 7 or 6 ... also returns the current number of header rows ...
    (comp.sys.hp48)
  • Re: HP 49G+ Display [TrigLib bug]
    ... it overwrites the header and leaves garbled pixels ... when the standard font height is either 7 or 6 ... also returns the current number of header rows ...
    (comp.sys.hp48)