IUP Computer Science
COSC 110    Spring 2007

Project #6
(Finding Poppies)
(Due 30 April 2007)

The DEA (Drug Enforcement Agency) has recently developed a new technique for identifying opium poppies from high altitude.  The technique is based on the discovery that opium poppies emit infrared radiation in a particular frequency range and at a fairly high intensity.  If an airplane flys over a suspected area and takes infrared sensor readings of the land beneath the plane, analysis of the readings can determine with a high degree of certainty where opium poppies are growing.

The airplane takes a "image" of the land, much like a digital camera but in infrared wave lengths.  It then stores the "image" in a file.  There is one pair of sensor readings for each 10-meter square on the ground.  Each pair of sensor readings consists of the dominant frequency, measured in micrometers, and the radiant emitance (intensity), measured in watts/meter2.  The "image" covers an area 2100 meters by 2100 meters (about 1.7 sq miles); so, it can be thought of as two parallel 210 by 210 two-dimensional arrays (one for frequency and one for intensity).   Opium poppies have an infrared signature in that they radiate in wave lengths between 3.0 and 4.0 micrometers inclusive and with an intensity that is 0.01 watts/meter2 or higher.

Because of inaccuracy in the sensor equipment, not every sensor reading pair with readings in the opium range can be regarded as being caused by opium poppies.  Instead, the analysis must examine the readings in groups of nine (3 by 3 readings) as a block;  if the sensor reading pair for each of the 9 squares shows the opium signature, then it is regarded as likely to contain opium poppies.  Anything less than all 9 squares having the signature readings is regarded as insufficient.

You are to write the program that analyzes the file of readings for an image and identifies the positions where opium poppies are likely to be.  On the next page is a sample of the readings from the "upper left corner" of the image.  The top number for each block is the frequency; the bottom is the intensity.  Note that although many reading pairs meet the opium criteria only the red block of nine reading pairs should be regarded as likely for opium poppies.  (In black & white printouts, this block is the darkest with white readings.)  The other colored squares show some of the 9-square groups that need to be examined.

The image file ( at I:\jlwolfe\110\sensor-image.txt ) has the following format.  The first line contains some text describing the location of the imaged area; this consists of several words  and numbers.  Each subsequent line contains one reading pair, frequency first, then intensity.  All reading pairs from the first row of the image are stored in sequence, left to right; this is followed by the second row in a similar arrangement, then the third, and so on.  The first few lines of the file actually look like this:

Quadrangle TR331997  Lat 40.29908  Lon 79.15552
8.54  0.008
1.42  0.003
3.12  0.011
 
 
 
8.54
.008
1.42
.003
3.12
.011
3.22
.013
3.06
.006
4.43
.007
7.99
.012
8.90
.007
4.06
.005
3.22
.011
3.78
.005
1.71
.012
     
1.75
.012
3.08
.014
7.32
.003
8.90
.002
10.0
.005
4.11
.011
5.02
.007
3.00
.012
3.20
.009
4.08
.007
         
4.19
.009
3.91
.010
5.20
.008
7.89
.013
8.23
.007
5.11
.002
3.77
.002
5.11
.003
7.85
.004
           
9.01
.003
4.11
.004
3.78
.012
3.54
.011
3.20
.010
3.87
.013
                 
5.22
.002
3.10
.014
4.11
.010
3.02
.010
3.04
.011
3.12
.010
                 
2.89
.002
3.44
.011
4.00
.013
3.45
.014
3.55
.014
3.62
.011
                 
5.11
.001
7.88
.005
9.88
.001
4.99
.001
5.10
.001
7.33
.003
                 
3.67
.012
3.23
.012
3.77
.010
8.22
.002
8.76
.002
                   
5.18
.014
4.50
.004
4.57
.001
                       

Your program should examine the 210 x 210 image in 3 x 3 blocks.  When it finds a block in which each square meets the opium criteria, the program should display the block's coordinates as  (row number, column number) considering that there are 70 rows and 70 columns of blocks.  For the red block shown above, the program should display (2, 2) because the red block is in the second row of blocks and in the second column of blocks (blocks are numbered 1-70 in rows and columns).  The program should also display the descriptive text from the first line of the file; actually, this text should be displayed before the locations of the opium blocks.

For extra credit, the program should  write to an output file a "map" showing graphically the location of the opium poppies.  The display should begin somewhat like this.  Additional extra credit may be earned by improving the "map" as indicated in the WebCT hints.

. . . . . . . . . .         The dots mark the boundary around
.                           the 70 x 70 map area.  Poppy locations
.   X                       are marked by an 'X'; other block
.                           positions appear as a blank.  The map
.             X             file should be named after you; for
.                           example, I would call mine wolfemap.txt

Hand in a printout of your well-documented program and a printout of the captured list of likely poppy positions that you captured from the screen.  Name your program after yourself; for example, I would name mine  wolfep6.cpp  Copy your .cpp file (and the map file that you create) to the handin folder for this course on the P: drive.