What Could Be Causing a Fortran Compilation Error During Image Processing?

  • Context: Fortran 
  • Thread starter Thread starter 6a Climber
  • Start date Start date
  • Tags Tags
    Error Fortran
Click For Summary

Discussion Overview

The discussion revolves around a Fortran compilation error encountered while running an image processing algorithm on a 500-frame video. Participants explore potential causes of the error, particularly focusing on file reading issues related to the video frames.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant suggests that the error may occur if the 20th or 21st frame does not contain the expected amount of data, recommending the insertion of an END=# parameter in the READ statements to diagnose the issue.
  • Another participant raises the possibility that the file may have been opened in the wrong mode (binary vs. ASCII), noting that ASCII mode looks for EOF markers, which could lead to premature EOF errors if not handled correctly.
  • A similar point is reiterated by another participant, emphasizing the importance of the file mode and the potential for reading errors due to the file format, particularly in relation to structured image files.
  • One participant mentions that there are multiple ways to read files in Fortran, including variable length text records, variable length binary records, and raw binary, suggesting that the third option may be necessary for image files.
  • Another participant requests the code to provide more useful assistance, indicating that the current information is insufficient for troubleshooting.

Areas of Agreement / Disagreement

Participants express various hypotheses regarding the cause of the error, with no consensus reached on a single solution or cause. Multiple competing views regarding file reading modes and error handling are presented.

Contextual Notes

Participants note the importance of file format and reading modes, but specific assumptions about the code or the environment are not fully explored. The discussion lacks detailed information about the operating system or Fortran version being used.

Who May Find This Useful

Individuals working with Fortran for image processing, particularly those encountering file reading errors or debugging similar algorithms.

6a Climber
Messages
1
Reaction score
0
Hi
I try to run an image processing algorithm (Cross-Correlation based) on fortran to analyze a 500 frames video, but after the 20th frame I get this error message:The program 'D:\Omri\19.12.11\Debug\Cross_Corr_Omri.exe' has exited with code -1073741800 (0xC0000018).

anf in the debug window I have this message:

forrtl: severe <24>: end-of file during read, unit 1, file: (the name of the file)I checked whether the video is only 20 frames long but it was 500 as it supposed to be...and the program ceases. I do have the results for the first 20 frames but I need the rest as well.

Thanks
 
Last edited:
Technology news on Phys.org
Likely the 20th or 21st frame doesn't have the expected number of data. Locate places in the code where a read occurs for unit 1 and insert an END=# parameter in the READ statement(s). That should result in a graceful halt where you can output diagnostics such as the number of records or data read and the number expected. (You may have to put a FLUSH(0) statement after your PRINTS to get the output.)
 
Another possible error is whether you've opened the file as binary or ascii. in ascii mode the file read routines will look for an EOF marker. In addition to looking for EOF markers they also might be looking for a CR or CRLF character sequence to denote an end of text line.

A binary data file will most likely have one of these characters somewhere and thus reading a binary file will result in reading lines short or premature EOF error.

This is also a common problem in C code.

The fortran binary might also be called raw mode as in don't look for any special character give me the data raw and unrefined.

Not knowing what OS or what FORTRAN here's a possible reference:

http://idlastro.gsfc.nasa.gov/idl_html_help/Reading_and_Writing_FORTRAN_Data.html
 
Last edited by a moderator:
jedishrfu said:
Another possible error is whether you've opened the file as binary or ascii. in ascii mode the file read routines will look for an EOF marker. In addition to looking for EOF markers they also might be looking for a CR or CRLF character sequence to denote an end of text line.

A binary data file will most likely have one of these characters somewhere and thus reading a binary file will result in reading lines short or premature EOF error.

This is also a common problem in C code.

The fortran binary might also be called raw mode as in don't look for any special character give me the data raw and unrefined.

Not knowing what OS or what FORTRAN here's a possible reference:

http://idlastro.gsfc.nasa.gov/idl_html_help/Reading_and_Writing_FORTRAN_Data.html

forgot to mention there are actually 3 ways to read a file in fortran
- as variable length text records
- as variable length binary records
- as raw binary where you seek to an address and read n bytes of data (random file)

It seems any image file would have a format that demands the 3rd option as it will have some structured tables for the imahe header, color palette and image data where each pixel is represented by 1, 2 or 4 bytes depending on the type of image with the 1 byte or 2 byte referencing a color in the palette table or as 4 bytes where each byte represents red, green, blue, intensity or some similar variation of values. The header would have provided meta info about the image such as size and type of color coding used.
 
Last edited by a moderator:
6a Climber said:
Hi
I try to run an image processing algorithm (Cross-Correlation based) on fortran to analyze a 500 frames video, but after the 20th frame I get this error message:


The program 'D:\Omri\19.12.11\Debug\Cross_Corr_Omri.exe' has exited with code -1073741800 (0xC0000018).

anf in the debug window I have this message:

forrtl: severe <24>: end-of file during read, unit 1, file: (the name of the file)


I checked whether the video is only 20 frames long but it was 500 as it supposed to be...


and the program ceases. I do have the results for the first 20 frames but I need the rest as well.

Thanks

This information us quite useless without the code. You need to post it.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 17 ·
Replies
17
Views
7K
  • · Replies 3 ·
Replies
3
Views
8K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 2 ·
Replies
2
Views
9K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 4 ·
Replies
4
Views
9K
Replies
5
Views
4K