y = imread(file1, 'BackgroundColor', [1 1 1]); WHAT DOES IT DO?

조회 수: 4 (최근 30일)
SURILA GUGLANI
SURILA GUGLANI 2018년 5월 26일
댓글: SURILA GUGLANI 2018년 5월 27일
I am getting an error in this line as:
Error using strfind
Input strings must have one row.
Error in getFileFromURL (line 8)
if (strfind(filenameIn, '://'))
Error in imread (line 327)
[isUrl, filename] = getFileFromURL(filename);
Error in oooo (line 63)
y = imread(I, 'BackgroundColor', [1 1 1]);

답변 (2개)

dpb
dpb 2018년 5월 26일
doc imread
Read image from graphics file
Syntax
A = imread(filename)
A = imread(filename,fmt)
A = imread(___,idx)
A = imread(___,Name,Value)
...
Description
A = imread(filename) reads the image from the file specified by filename, inferring the format of the file
from its contents. If filename is a multi-image file, then imread reads the first image in the file.
A = imread(filename,fmt) additionally specifies the format of the file with the standard file extension indicated
by fmt. If imread cannot find a file with the name specified by filename, it looks for a file named filename.fmt.
...
A = imread(___,Name,Value) specifies format-specific options using one or more name-value pair arguments,
in addition to any of the input arguments in the previous syntaxes.
...
Ergo, the first argument must be a valid filename string; you've passed what looks to be an array, I.
  댓글 수: 6
Walter Roberson
Walter Roberson 2018년 5월 26일
Huh, so it is!
SURILA GUGLANI
SURILA GUGLANI 2018년 5월 27일
Sorry, for the typing error.

댓글을 달려면 로그인하십시오.


SURILA GUGLANI
SURILA GUGLANI 2018년 5월 27일
I is the name of the image file.. this image is extracted from a video and then saved in my computer. so I wrote
I = imread('Frame 0001.png') And later in the code used as...
y = imread(I, 'BackgroundColor', [1 1 1]); Is something wrong with it?
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 5월 27일
After you do
I = imread('Frame 0001.png') And later in the code used as...
then I is the content of Frame 0001.png , and is not a file name.
You would need something like
filename = 'Frame 0001.png';
I = imread(filename);
y = imread(filename, 'BackgroundColor', [1 1 1]);

댓글을 달려면 로그인하십시오.

제품


릴리스

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by