2020. 2. 8. 23:20ㆍ카테고리 없음
Image Display with IDL Image Display with IDL IDL provides many tools for displaying, modifying and analyzing images. The topics in this section are meant to get you started with a basic set of tools. We will enlarge this toolbox as we go along in the course.
The topics of this section are:. Reading Image Data Image data can be read from files in several formats.
Information on interactive tools and software programs available to help access EUMETSAT data. Read routine based on the IDL EPS product readers version 2.0 has.
For example, if you have an image named scene.png in a directory then you can read it by supplying the path to the image to the Readpng procedure. If the directory is named myimages on the C drive then you could read the image into an array named image by executing the command IDL Readpng,'C: myimages scene.png',image IDL provides routines of the form Readxxx to read a number of image formats.
Look in the IDL Help index for further information. The supported formats in IDL version 5.2 include: BMP, DICOM, GIF, JPEG, PICT, PNG, PPM, SRF, TIFF. Each procedure has keyword parameters to set. Beginning with version 5.3, IDL provides a generic image-reading routine called READIMAGE. It can be used as either a procedure or a function. To be most effective, it can be used with the QUERYIMAGE function, which can provide information about an image before a read attempt is made.
I find it handy to use the DialogPickfile function to help me pick the full name of the image file. This has the added advantage that it will construct a full file name for whatever machine is being used. If you are looking for images with a particular name pattern, you can use the filter keyword. For example, to pick an image of type png you can do the following: IDL fname=DialogPickfile(FILTER='.png') IDL ok=QueryImage(fname,info) The variable OK will equal 1 if the image file can be read and 0 if it cannot be read. The variable INFO is a structure that contains information about the image in the file.
You can find out what fields are in the structure by using HELP. IDL Help,info,/STRUCTURE Suppose that we had picked the file fname='peppers.png'. Then the info structure would be as shown below. Structure, 7 tags, length=40, data length=36, refs=1: CHANNELS LONG 1 DIMENSIONS LONG Array2 HASPALETTE INT 1 IMAGEINDEX LONG 0 NUMIMAGES LONG 1 PIXELTYPE INT 1 TYPE STRING 'PNG' The image has a palette. That means that the image array contains the indexes for the palette.
To display the image we will need to use the palette information to set up the color system. Both the image array and the color palette can be read by the READIMAGE function. IDL image=ReadImage(fname,rr,gg,bb) IDL Device,DECOMPOSED=0;Tell IDL to use indexed color system IDL TVLCT,rr,gg,bb;Sets up the internal palette IDL Window,1,XSIZE=info.dimensions0,YSIZE=info.dimensions1 IDL TV,image This image uses color tables.
We will also look at an example that uses true color. Color tables are discussed. Setting up display windows The image display procedures, TV and TVSCL that are discussed will display an image in the active window or open a new window if there is no active window. This is ok if it is what you want. However, the result may be a window of the wrong size or location on the screen.
To make a window of the right size, you have to find out the size of the image and then open a window of that size. The image array image that was read above is two-dimensional. You can find the image size and open a window that it fits with the following commands: IDL imSize=SIZE(image) IDL WINDOW,/FREE,XSIZE=imSize1,YSIZE=imSize2 If you want to open or resize a window with a particular window index n then use the command IDL WINDOW,n,XSIZE=imSize1,YSIZE=imSize2 If the window is open, then this command also erases the contents. You can control the position of a window on the screen by using the XPOS and YPOS keyword parameters. For more information see IDL Help. Displaying byte arrays IDL uses two commands to display image data on the screen: TV and TVSCL. These procedures use the same arguments and keywords and differ only in that TVSCL scales the image into the intensity range of the display device, while TV displays the image directly.
They have the form: TV, image , X, Y TVSCL, image , X, Y where A is a 2D array and X and Y are optional location parameters. If they are used, they determine the offset of the image origin from the corner of the window. Other parameters are available, as described in IDL Help. If one issues the command IDL TV,image then the image will be displayed in the current window. If there is no open window, then one with the default window size will be opened.
If you want to put the image into a window of the same size, then you need to find out the size of the image and open a window to match it. You could do this manually by finding the size with the Help command and then typing the parameters into the Window procedure. However, you will often want to automate the process so you can put it into a program. To do that, use QueryImage function or the Size procedure. An example of the use of Size is: IDL imSize=SIZE(image) IDL Window,/FREE,XSIZE=imSize1,YSIZE=imSize2 IDL TV,image The image that is displayed may not look like what you expect because the range of values may not match the color table or because the image color table was different than the current color table.
Information about the range of colors in the color table is stored in the system variable!D.NColors. One can rescale the image to match the color table by use of the BytScl function. IDL imSize=SIZE(image) IDL Window,/FREE,XSIZE=imSize1,YSIZE=imSize2 IDL scImage=BytScl(image,TOP=!D.NColors-1) IDL TV,scimage scImage is a new array of the same size as image but with a range of values from 0 to!D.NColors. You can accomplish the same rescaling by using the TVSCL procedure. The image displayed with the following commands will look the same as that displayed with those above.
Zip File Open
IDL imSize=SIZE(image) IDL Window,/FREE,XSIZE=imSize1,YSIZE=imSize2 IDL TVSCL,image The TVSCL procedure provides a quick way to display an image so that you will get good contrast. However, scaling the image yourself and displaying it with TV will give you greater control. The TV and TVSCL procedures do not give you any control of the color appearance of a displayed image. To do that you have to use the tools that control the color pallette. Using color tables IDL displays images in either 8-bit or 24-bit color. Here we will discuss image display with 8-bit color, which is also called indexed color. The simplest way to understand indexed color is to run the procedure XPALETTE in IDL.
Idl Snap File Open 2.0 For Mac Pro
This will bring up a window that displays the current color table and that enables you to change colors. Click to see an example. Indexed color makes use of three color channels, called Red, Green and Blue. A displayed color is composed of a mixture of the three colors. Each color index corresponds to a particular mixture.
The three graphs in the left column of the XPALETTE window show the r,g,b mixture for each index. The number of available indexes on a particular computer is provided by the system variable,!D.NCOLORS. This value is displayed at the top of the center column in the window, and shows 236 colors available in this example. The controls in the XPALETTE window enable you to manipulate the color table.
The procedure is simple to follow if you first click on the help button while running XPALETTE. The color table itself is displayed on the right.
It is a 16x16 array. You can use the tools to change the color table. The index slider at the top shows that the cursor is on color index 168. IDL has a number of predefined color tables.
Pdf File Open Software Free Download
These can be loaded by using the LOADCT procedure. For example, LOADCT,3 would load the RED TEMPERATURE color table. This happens to be the color table displayed in the example. You can load any of the predefined color tables in XPALETTE by using the Predefined button. The available color tables are listed below. These color tables are most useful when doing graphics.