Image From File
Read image from file location

Libraries:
Computer Vision Toolbox /
Sources
Description
The Image From File block reads an image from a specified file location and imports it to the Simulink® workspace. The input file can contain a binary image, grayscale image, or color image.
Examples
Import Image from Specified Location
Import an image from a file in the specified location to the Simulink® workspace by using the Image
From
File
block.
Ports
Output
Output image, returned as a matrix or 3-D array. If the image read is a binary or grayscale image, the output is an M-by-N matrix. If the image read is a color image, the output is an M-by-N-by-3 array.
Dependencies
To enable this port, set the Image signal parameter to
One multidimensional signal
.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| Boolean
| fixed point
Red color component of the image, returned as an M-by-N matrix. The block returns this output if the input is a color image. If the Image signal parameter is set to Separate color signals and the input image is grayscale, the block returns only this port.
Dependencies
To enable this port, set the Image signal parameter to
Separate color signals
.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| Boolean
| fixed point
Green color component of the image, returned as an M-by-N matrix. The block returns this output only if the input is a color image.
Dependencies
To enable this port, set the Image signal parameter to
Separate color signals
.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| Boolean
| fixed point
Blue color component of the image, returned as an M-by-N matrix. The block returns this output only if the input is a color image.
Dependencies
To enable this port, set the Image signal parameter to
Separate color signals
.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| Boolean
| fixed point
Parameters
Specify the name of the file that contains the image to read. If the file is not on
the MATLAB® path, click Browse and navigate to the file. For
the list of supported file formats, see the imread
function reference page in the MATLAB documentation.
Note
The File name parameter supports URL paths.
Specify the sample time for block execution. Vector length must be 2 which represents [Period, Offset] values where offset should be less than period and non-negative. Given the default value of inf, the block outputs a matrix for grayscale and binary. For an input grayscale or color image, the output is a 3-D or 4-D array, respectively.
The value of the added dimension is equal to floor((Tsim/Ts)+1).
Tsim is the simulation time and Ts is the sample time, for block execution. For example, if the input image is a 256-by-256 matrix, the simulation time is 10 sec, and the sample time is set to 0.5 sec, then the output is a 256-by-256-by-21 array.
Specify how the block returns the image read from the file.
One multidimensional signal
— The block has one output port, which returns the entire image.Separate color signals
— The block has three output ports, one for each color channel, which returns the individual color channels of the image.
Specify the labels for the output ports. Each label can be any value. Use vertical bar character, |, as a delimiter between the names of all the output ports.
Dependencies
To enable this parameter, set the Image signal parameter to
Separate color signals
.
Data type
Specify the data type of the output image. If the input image data type,differs from the selected value of the Output data type parameter, the block scales the pixel values, adds an offset to the pixel values so that they are in the dynamic range of the new data type, or both. Double- and single-precision floating-point pixel values must be in the range [0 1].
Select this parameter if the input image data type is signed fixed-point.
Dependencies
To enable this parameter, set the Output data type parameter
to Fixed-point
.
Specify the word length, in bits, of the fixed-point output data type. The value should be less than 32.
Dependencies
To enable this parameter, set the Output data type parameter
to Fixed-point
.
Specify the scaling factor of the fixed-point output as one of these options.
Best precision
— The output scales automatically such that the output signal has the best possible precision.Choose
User-defined
— Specify the output scaling in the Fraction length parameter.
Dependencies
To enable this parameter, set the Output data type parameter
to Fixed-point
.
Specify the number of bits to the right of the decimal point.
Dependencies
To enable this port ,set the Output data type parameter to
Fixed-point
, and set the Set fraction length in
output parameter to User-defined
.
Specify any built-in or fixed-point data type. You can specify fixed-point data
types using the fixdt
(Simulink) function.
Dependencies
To enable this parameter, set the Output data type parameter
to User-defined
.
Block Characteristics
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced before R2006a
See Also
Blocks
- From Multimedia File | Image From Workspace | To Video Display | Video From Workspace | Video Viewer
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)