回 帖 发 新 帖 刷新版面

主题:[讨论]关于图像的读取问题

matlab中的imread函数只能读取硬盘上的图像文件么?
为了追求最快的速度,可不可以从内存读取,比如抓取一个图片时,图片应该是在内存里,可以直接传递给matlab么?
不知道用内存映射文件能否实现?
或是重载imread函数,或是自定义一个读取函数,或是用dll等,有没有高手指点一下,万分感激.
已经放弃这种方法了,算了.

回复列表 (共4个回复)

沙发


不好意思,既然在这里提了,我想咨询一下,电脑上存的照片可以读取吗?我是新手,实在不懂

板凳


可以

3 楼

IMREAD Read image from graphics file.
    A = IMREAD(FILENAME,FMT) reads a grayscale or color image from the file
    specified by the string FILENAME. If the file is not in the current
    directory, or in a directory on the MATLAB path, specify the full 
    pathname.
    
    The text string FMT specifies the format of the file by its standard
    file extension. For example, specify 'gif' for Graphics Interchange 
    Format files. To see a list of supported formats, with their file 
    extensions, use the IMFORMATS function. If IMREAD cannot find a file 
    named FILENAME, it looks for a file named FILENAME.FMT.
 
    The return value A is an array containing the image data. If the file 
    contains a grayscale image, A is an M-by-N array. If the file contains
    a truecolor image, A is an M-by-N-by-3 array. For TIFF files containing
    color images that use the CMYK color space, A is an M-by-N-by-4 array. 
    See TIFF in the Format-Specific Information section for more
    information.
    
    The class of A depends on the bits-per-sample of the image data,
    rounded to the next byte boundary. For example, IMREAD returns 24-bit
    color data as an array of uint8 data because the sample size for each
    color component is 8 bits. See the Remarks section for a discussion of  
    bitdepths, and see the Format-Specific Information section for more  
    detail about supported bitdepths and sample sizes for a particular
    format.
     
    [X,MAP] = IMREAD(FILENAME,FMT) reads the indexed image in FILENAME into
    X and its associated colormap into MAP. Colormap values in the image 
    file are automatically rescaled into the range [0,1]. 
  
    [...] = IMREAD(FILENAME) attempts to infer the format of the file
    from its content.
  
    [...] = IMREAD(URL,...) reads the image from an Internet URL.  The
    URL must include the protocol type (e.g., "http://"). 
     
    Remarks
     
    Bitdepth is the number of bits used to represent each image pixel.  
    Bitdepth is calculated by multiplying the bits-per-sample with the 
    samples-per-pixel. Thus, a format that uses 8-bits for each color 
    component (or sample) and three samples per pixel has a bitdepth of 24.
    Sometimes the sample size associated with a bitdepth can be ambiguous: 
    does a 48-bit bitdepth represent six 8-bit samples or three 16-bit 
    samples? The following format-specific sections provide sample size 
    information to avoid this ambiguity.

4 楼


其实读取图像是比较容易的!!!
例如: clear;clc;
close all;
I=imread('32.jpg');%IMG_left_0comexple.bmp/b10_1 w2.bmp
I1 = rgb2gray(I);
figure,imshow(I1);title('circuit image');%灰度处理
这个还有灰度处理的。

我来回复

您尚未登录,请登录后再回复。点此登录或注册