⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imshow.cpp

📁 matlab的可执行程序
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    mwArray figHandle = mwArray::UNDEFINED;
    mwArray imsize = mwArray::UNDEFINED;
    mwArray truesizeStr = mwArray::UNDEFINED;
    mwArray filename = mwArray::UNDEFINED;
    mwArray ydata = mwArray::UNDEFINED;
    mwArray xdata = mwArray::UNDEFINED;
    mwArray map = mwArray::UNDEFINED;
    mwArray clim = mwArray::UNDEFINED;
    mwArray cdatamapping = mwArray::UNDEFINED;
    mwArray cdata = mwArray::UNDEFINED;
    mwArray newFigure = mwArray::UNDEFINED;
    //
    // %IMSHOW Display image.
    // %   IMSHOW(I,N) displays the intensity image I with N discrete
    // %   levels of gray. If you omit N, IMSHOW uses 256 gray levels on
    // %   24-bit displays, or 64 gray levels on other systems.
    // %
    // %   IMSHOW(I,[LOW HIGH]) displays I as a grayscale intensity
    // %   image, specifying the data range for I. The value LOW (and
    // %   any value less than LOW) displays as black, the value HIGH
    // %   (and any value greater than HIGH) displays as white, and
    // %   values in between display as intermediate shades of
    // %   gray. IMSHOW uses the default number of gray levels. If you
    // %   use an empty matrix ([]) for [LOW HIGH], IMSHOW uses
    // %   [min(I(:)) max(I(:))]; the minimum value in I displays as
    // %   black, and the maximum value displays as white.
    // %
    // %   IMSHOW(BW) displays the binary image BW. Values of 0 display
    // %   as black, and values of 1 display as white.
    // %
    // %   IMSHOW(X,MAP) displays the indexed image X with the colormap
    // %   MAP.
    // %
    // %   IMSHOW(RGB) displays the truecolor image RGB.
    // %
    // %   IMSHOW(...,DISPLAY_OPTION) displays the image, calling
    // %   TRUESIZE if DISPLAY_OPTION is 'truesize', or suppressing the
    // %   call to TRUESIZE if DISPLAY_OPTION is 'notruesize'. Either
    // %   option string can be abbreviated. If you do not supply this
    // %   argument, IMSHOW determines whether to call TRUESIZE based on
    // %   the setting of the 'ImshowTruesize' preference.
    // %
    // %   IMSHOW(x,y,A,...) uses the 2-element vectors x and y to
    // %   establish a nondefault spatial coordinate system, by
    // %   specifying the image XData and YData.  Note that x and y can 
    // %   have more than 2 elements, but only the first and last 
    // %   elements are actually used.
    // %
    // %   IMSHOW(FILENAME) displays the image stored in the graphics
    // %   file FILENAME. IMSHOW calls IMREAD to read the image from the
    // %   file, but the image data is not stored in the MATLAB
    // %   workspace. The file must be in the current directory or on
    // %   the MATLAB path.
    // %
    // %   H = IMSHOW(...) returns the handle to the image object
    // %   created by IMSHOW.
    // %
    // %   Class Support
    // %   -------------
    // %   The input image can be of class logical, uint8, uint16,
    // %   or double, and it must be nonsparse.
    // % 
    // %   Remarks
    // %   -------
    // %   You can use the IPTSETPREF function to set several toolbox
    // %   preferences that modify the behavior of IMSHOW:
    // %
    // %   - 'ImshowBorder' controls whether IMSHOW displays the image
    // %     with a border around it.
    // %
    // %   - 'ImshowAxesVisible' controls whether IMSHOW displays the
    // %     image with the axes box and tick labels.
    // %
    // %   - 'ImshowTruesize' controls whether IMSHOW calls the TRUESIZE
    // %     function.
    // %
    // %   For more information about these preferences, see the
    // %   reference entry for IPTSETPREF.
    // %
    // %   See also IMREAD, IMVIEW, IPTGETPREF, IPTSETPREF, SUBIMAGE, TRUESIZE, WARP, IMAGE, IMAGESC.
    // 
    // %   Copyright 1993-2003 The MathWorks, Inc.  
    // %   $Revision: 5.40 $  $Date: 2003/02/18 17:16:36 $
    // 
    // % 1. Parse input arguments
    // % 2. Get an axes to plot in.
    // % 3. Create the image and axes objects and set their display
    // %    properties.
    // % 4. If the image is alone in the figure, position the axes
    // %    according to the current IMBORDER setting and then call
    // %    TRUESIZE.
    // %
    // % Local function:
    // % ParseInputs
    // % IsVector
    // % DoTruesize
    // 
    // newFigure = isempty(get(0,'CurrentFigure')) | ...
    //
    newFigure
      = isempty(Nget(1, mwVarargin(_mxarray0_, _mxarray1_)))
        | strcmp(
            Nget(
              1,
              mwVarargin(
                Nget(1, mwVarargin(_mxarray0_, _mxarray1_)), _mxarray3_)),
            _mxarray5_);
    //
    // strcmp(get(get(0,'CurrentFigure'), 'NextPlot'), 'new');
    // 
    // [cdata, cdatamapping, clim, map, xdata, ydata, filename, ...
    // truesizeStr] = ParseInputs(varargin{:});
    //
    cdata
    = imshow_ParseInputs(
        &cdatamapping,
        &clim,
        &map,
        &xdata,
        &ydata,
        &filename,
        &truesizeStr,
        mwVarargin(mwVa(varargin, "varargin").cell(colon())));
    //
    // imsize = size(cdata);
    //
    imsize = size(mwValueVarargout(), mwVv(cdata, "cdata"));
    //
    // imsize = imsize(1:2);  % In case ndims(cdata) > 2
    //
    imsize = mclArrayRef(mwVv(imsize, "imsize"), colon(_mxarray7_, _mxarray8_));
    //
    // 
    // if (newFigure)
    //
    if (tobool(mwVv(newFigure, "newFigure"))) {
        //
        // figHandle = figure('Visible', 'off');
        //
        figHandle = Nfigure(1, mwVarargin(_mxarray9_, _mxarray11_));
        //
        // axHandle = axes('Parent', figHandle);
        //
        axHandle
          = Naxes(1, mwVarargin(_mxarray13_, mwVv(figHandle, "figHandle")));
    //
    // else
    //
    } else {
        //
        // axHandle = newplot;
        //
        axHandle = Nnewplot(1, mwArray::DIN);
        //
        // figHandle = get(axHandle, 'Parent');
        //
        figHandle
          = Nget(1, mwVarargin(mwVv(axHandle, "axHandle"), _mxarray13_));
    //
    // end
    //
    }
    //
    // 
    // % Make the image object.
    // hh = image(xdata, ydata, cdata, 'BusyAction', 'cancel', ...
    //
    hh
      = Nimage(
          1,
          mwVarargin(
            mwVv(xdata, "xdata"),
            mwVv(ydata, "ydata"),
            mwVv(cdata, "cdata"),
            _mxarray15_,
            _mxarray17_,
            _mxarray13_,
            mwVv(axHandle, "axHandle"),
            _mxarray19_,
            mwVv(cdatamapping, "cdatamapping"),
            _mxarray21_,
            _mxarray11_));
    //
    // 'Parent', axHandle, 'CDataMapping', cdatamapping, ...
    // 'Interruptible', 'off');
    // 
    // % Set axes and figure properties if necessary to display the 
    // % image object correctly.
    // showAxes = iptgetpref('ImshowAxesVisible');
    //
    showAxes = iptgetpref(_mxarray23_);
    //
    // set(axHandle, ...
    //
    ans.EqAns(
      Nset(
        0,
        mwVarargin(
          mwVv(axHandle, "axHandle"),
          _mxarray25_,
          _mxarray27_,
          _mxarray29_,
          _mxarray11_,
          _mxarray31_,
          _mxarray11_,
          _mxarray33_,
          _mxarray35_,
          _mxarray37_,
          _mxarray39_,
          _mxarray9_,
          mwVv(showAxes, "showAxes"))));
    //
    // 'TickDir', 'out', ...
    // 'XGrid', 'off', ...
    // 'YGrid', 'off', ...
    // 'DataAspectRatio', [1 1 1], ...
    // 'PlotBoxAspectRatioMode', 'auto', ...
    // 'Visible', showAxes);
    // set(get(axHandle,'Title'),'Visible','on');
    //
    ans.EqAns(
      Nset(
        0,
        mwVarargin(
          Nget(1, mwVarargin(mwVv(axHandle, "axHandle"), _mxarray41_)),
          _mxarray9_,
          _mxarray43_)));
    //
    // set(get(axHandle,'XLabel'),'Visible','on');
    //
    ans.EqAns(
      Nset(
        0,
        mwVarargin(
          Nget(1, mwVarargin(mwVv(axHandle, "axHandle"), _mxarray45_)),
          _mxarray9_,
          _mxarray43_)));
    //
    // set(get(axHandle,'YLabel'),'Visible','on');
    //
    ans.EqAns(
      Nset(
        0,
        mwVarargin(
          Nget(1, mwVarargin(mwVv(axHandle, "axHandle"), _mxarray47_)),
          _mxarray9_,
          _mxarray43_)));
    //
    // if (~isempty(map))
    //
    if (mclNotBool(isempty(mwVv(map, "map")))) {
        //
        // set(figHandle, 'Colormap', map);
        //
        ans.EqAns(
          Nset(
            0,
            mwVarargin(
              mwVv(figHandle, "figHandle"), _mxarray49_, mwVv(map, "map"))));
    //
    // end
    //
    }
    //
    // if (~isempty(clim))
    //
    if (mclNotBool(isempty(mwVv(clim, "clim")))) {
        //
        // set(axHandle, 'CLim', clim);
        //
        ans.EqAns(
          Nset(
            0,
            mwVarargin(
              mwVv(axHandle, "axHandle"), _mxarray51_, mwVv(clim, "clim"))));
    //
    // end
    //
    }
    //
    // 
    // % Do truesize if called for.
    // truesizePref = iptgetpref('ImshowTruesize');
    //
    truesizePref = iptgetpref(_mxarray53_);
    //
    // autoTruesize = strcmp(truesizePref, 'auto');
    //
    autoTruesize = strcmp(mwVv(truesizePref, "truesizePref"), _mxarray39_);
    //
    // singleImage = SingleImageDefaultPos(figHandle, axHandle);
    //
    singleImage
      = imshow_SingleImageDefaultPos(
          mwVv(figHandle, "figHandle"), mwVv(axHandle, "axHandle"));
    //
    // 
    // 
    // % Syntax specification overrides truesize preference setting.
    // if (strcmp(truesizeStr, 'notruesize'))
    //
    if (tobool(strcmp(mwVv(truesizeStr, "truesizeStr"), _mxarray55_))) {
        //
        // callTruesize = 0;
        //
        callTruesize = _mxarray0_;
    //
    // 
    // elseif (strcmp(truesizeStr, 'truesize'))
    //
    } else if (tobool(strcmp(mwVv(truesizeStr, "truesizeStr"), _mxarray57_))) {
        //
        // callTruesize = 1;
        //
        callTruesize = _mxarray7_;
    //
    // 
    // else
    //
    } else {
        //
        // % If there was no command-line override, and the truesize preference
        // % is 'on', we still might not want to call truesize if the image
        // % isn't the only thing in the figure, or if it isn't in the 
        // % default position.
        // 
        // if (autoTruesize)
        //
        if (tobool(mwVv(autoTruesize, "autoTruesize"))) {
            //
            // callTruesize = singleImage;
            //
            callTruesize = mwVv(singleImage, "singleImage");
        //
        // else
        //
        } else {
            //
            // callTruesize = 0;
            //
            callTruesize = _mxarray0_;
        //
        // end
        //
        }
    //
    // end
    //
    }
    //
    // 
    // % Adjust according to ImshowBorder setting, unless we don't have a single
    // % image in the default position.
    // borderPref = iptgetpref('ImshowBorder');
    //
    borderPref = iptgetpref(_mxarray59_);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -