<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>image &#8211; Undocumented Matlab</title>
	<atom:link href="https://undocumentedmatlab.com/articles/tag/image/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Sun, 09 Feb 2020 19:54:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.3</generator>
	<item>
		<title>Auto-scale image colors</title>
		<link>https://undocumentedmatlab.com/articles/auto-scale-image-colors?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=auto-scale-image-colors</link>
					<comments>https://undocumentedmatlab.com/articles/auto-scale-image-colors#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 21 Feb 2018 18:06:23 +0000</pubDate>
				<category><![CDATA[Handle graphics]]></category>
		<category><![CDATA[Listeners]]></category>
		<category><![CDATA[Medium risk of breaking in future versions]]></category>
		<category><![CDATA[Undocumented feature]]></category>
		<category><![CDATA[HG2]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[Listener]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=7334</guid>

					<description><![CDATA[<p>Images can be automatically color-scaled for maximum resolution, using the undocumented MarkedClean  event. </p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/auto-scale-image-colors">Auto-scale image colors</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/image-easter-egg" rel="bookmark" title="Image Easter egg">Image Easter egg </a> <small>The default image presented by Matlab's image function has a very interesting undocumented story....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/auto-completion-widget" rel="bookmark" title="Auto-completion widget">Auto-completion widget </a> <small>Matlab includes a variety of undocumented internal controls that can be used for an auto-completion component. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/persisting-transparent-colors-in-hg2" rel="bookmark" title="Persisting transparent colors in HG2">Persisting transparent colors in HG2 </a> <small>We can set semi- and fully-transparent colors in HG2 for multiple graphic objects, but making these settings stick is non-trivial. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/uitable-cell-colors" rel="bookmark" title="Uitable cell colors">Uitable cell colors </a> <small>A few Java-based customizations can transform a plain-looking data table into a lively colored one. ...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>I deal extensively in image processing in one of my consulting projects. The images are such that most of the interesting features are found in the central portion of the image. However, the margins of the image contain z-values that, while not interesting from an operational point-of-view, cause the displayed image&#8217;s color-limits (axes <b>CLim</b> property) to go wild. An image is worth a thousand words, so check the following raw image (courtesy of Flightware, Inc.), displayed by the following simple script:</p>
<pre lang="matlab">hImage = imagesc(imageData); colormap(gray); colorbar;</pre>
<p><center><figure style="width: 400px" class="wp-caption aligncenter"><img fetchpriority="high" decoding="async" src="https://undocumentedmatlab.com/images/baseline2_1.png" alt="Raw image with default Matlab CLim" title="Raw image with default Matlab CLim" width="400" height="299" /><figcaption class="wp-caption-text">Raw image with default Matlab CLim</figcaption></figure></center></p>
<h3 id="rescale">Rescaling the axes color-limits</h3>
<p>As you can see, this image is pretty useless for human-eye analysis. The reason is that while all of the interesting features in the central portion of the image have a z-value of ~-6, the few pixels in the margins that have a z-value of 350+ screw up the color limits and ruin the perceptual resolution (image contrast). We could of course start to guess (or <i><b>histogram</b></i> the z-values) to get the interesting color-limit range, and then manually set <code>hAxes.CLim</code> to get a much more usable image:</p>
<pre lang="matlab">hAxes = hImage.Parent; hAxes.CLim = [-7.5,-6];</pre>
<p><center><figure style="width: 400px" class="wp-caption aligncenter"><img decoding="async" src="https://undocumentedmatlab.com/images/static_1.png" alt="Raw image with a custom CLim" title="Raw image with a custom CLim" width="400" height="299" /><figcaption class="wp-caption-text">Raw image with a custom CLim</figcaption></figure></center></p>
<h3 id="autoscale">Auto-scaling the axes color-limits</h3>
<p>Since the z-values range and distribution changes between different images, it would be better to automatically scale the axes color-limits based on an analysis of the image. A very simple technique for doing this is to take the 5%,95% or 10%,90% percentiles of the data, clamping all outlier data pixels to the extreme colors. If you have the Stats Toolbox you can use the <i><b>prctile</b></i> function for this, but if not (or even if you do), here&#8217;s a very fast alternative that automatically scales the axes color limits based on the specified threshold (a fraction between 0-0.49):<br />
<span id="more-7334"></span></p>
<pre lang="matlab">
% Rescale axes CLim based on displayed image portion's CData
function rescaleAxesClim(hImage, threshold)
    % Get the displayed image portion's CData
    CData = hImage.CData;
    hAxes = hImage.Parent;
    XLim = fix(hAxes.XLim);
    YLim = fix(hAxes.YLim);
    rows = min(max(min(YLim):max(YLim),1),size(CData,1)); % visible portion
    cols = min(max(min(XLim):max(XLim),1),size(CData,2)); % visible portion
    CData = CData(unique(rows),unique(cols));
    CData = CData(:);  % it's easier to work with a 1d array
    % Find the CLims from this displayed portion's CData
    CData = sort(CData(~isnan(CData)));  % or use the Stat Toolbox's prctile()
    thresholdVals = [threshold, 1-threshold];
    thresholdIdxs = fix(numel(CData) .* thresholdVals);
    CLim = CData(thresholdIdxs);
    % Update the axes
    hAxes.CLim = CLim;
end
</pre>
<p>Note that a threshold of 0 uses the full color range, resulting in no <b>CLim</b> rescaling at all. At the other extreme, a threshold approaching 0.5 reduces the color-range to a single value, basically reducing the image to an unusable B/W (rather than grayscale) image. Different images might require different thresholds for optimal contrast. I believe that a good starting point for the threshold is a value of 0.10, which corresponds to the 10-90% range of <b>CData</b> values.</p>
<h3 id="dynamic">Dynamic auto-scaling of axes color-limits</h3>
<p>This is very nice for the initial image display, but if we zoom-in, or pan a sub-image around, or update the image in some way, we would need to repeat calling this <i>rescaleAxesClim()</i> function every time the displayed image portion changes, otherwise we might still get unusable images. For example, if we zoom into the image above, we will see that the color-limits that were useful for the full image are much less useful on the local sub-image scale. The first (left) image uses the static custom color limits [-7.5,-6] above (i.e., simply zooming-in on that image, without modifying <b>CLim</b> again); the second (right) image is the result of repeating the call to <i>rescaleAxesClim()</i>, which improves the image contrast:<br />
<center><figure style="width: 400px" class="wp-caption aligncenter"><img decoding="async" src="https://undocumentedmatlab.com/images/static_4.png" alt="Zoomed-in image with a custom static CLim" title="Zoomed-in image with a custom static CLim" width="400" height="299" /><figcaption class="wp-caption-text">Zoomed-in image with a custom static CLim</figcaption></figure> <figure style="width: 400px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" src="https://undocumentedmatlab.com/images/dynamic_4.png" alt="Zoomed-in image with a re-applied custom CLim" title="Zoomed-in image with a re-applied custom CLim" width="400" height="299" /><figcaption class="wp-caption-text">Zoomed-in image with a re-applied custom CLim</figcaption></figure> </center><br />
We could in theory attach the <i>rescaleAxesClim()</i> function as a callback to the <i><b>zoom</b></i> and <i><b>pan</b></i> functions (that provide such callback hooks). However, we would still need to remember to manually call this function whenever we modify the image or its containing axes programmatically.<br />
A much simpler way is to attach our <i>rescaleAxesClim()</i> function as a callback to the image&#8217;s undocumented <a href="/articles/undocumented-hg2-graphics-events" target="_blank"><b>MarkedClean</b> event</a>:</p>
<pre lang="matlab">
% Instrument image: add a listener callback to rescale upon any image update
addlistener(hImage, 'MarkedClean', @(h,e)rescaleAxesClim(hImage,threshold));
</pre>
<p>In order to avoid callback recursion (potentially caused by modifying the axes <b>CLim</b> within the callback), we need to add a bit of code to the callback that prevents recursion/reentrancy (<a href="/articles/controlling-callback-re-entrancy" target="_blank">details</a>). Here&#8217;s one simple way to do this:</p>
<pre lang="matlab">
% Rescale axes CLim based on displayed image portion's CData
function rescaleAxesClim(hImage, threshold)
    % Check for callback reentrancy
    inCallback = getappdata(hImage, 'inCallback');
    if ~isempty(inCallback), return, end
    try
        setappdata(hImage, 'inCallback',1);  % prevent reentrancy
        % Get the displayed image portion's CData
        ...  (copied from above)
        % Update the axes
        hAx.CLim = CLim;
        drawnow; pause(0.001);  % finish all graphic updates before proceeding
    catch
    end
    setappdata(hImage, 'inCallback',[]);  % reenable this callback
end
</pre>
<p>The result of this dynamic automatic color-scaling can be seen below:<br />
<center><figure style="width: 400px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" src="https://undocumentedmatlab.com/images/dynamic_animated.gif" alt="Zoomed-in image with dynamic CLim" title="Zoomed-in image with dynamic CLim" width="400" height="299" /><figcaption class="wp-caption-text">Zoomed-in image with dynamic CLim</figcaption></figure></center></p>
<h3 id="autoScaleImageCLim">autoScaleImageCLim utility</h3>
<p>I have created a small utility called <i><b>autoScaleImageCLim</b></i>, which includes all the above, and automatically sets the specified input image(s) to use auto color scaling. Feel free to download this utility from <a href="https://www.mathworks.com/matlabcentral/fileexchange/66148-autoscaleimageclim" rel="nofollow" target="_blank">the Matlab File Exchange</a>. Here are a few usage examples:</p>
<pre lang="matlab">
autoScaleImageCLim()           % auto-scale the current axes' image
autoScaleImageCLim(hImage,5)   % auto-scale image using 5%-95% CData limits
autoScaleImageCLim(hImage,.07) % auto-scale image using 7%-93% CData limits
</pre>
<p>(note that the <code>hImage</code> input parameter can be an array of image handles)<br />
Hopefully one day the so-useful <b>MarkedClean</b> event will become a documented and fully-supported event for all HG objects in Matlab, so that we won&#8217;t need to worry that it might not be supported by some future Matlab release&#8230;</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/auto-scale-image-colors">Auto-scale image colors</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/image-easter-egg" rel="bookmark" title="Image Easter egg">Image Easter egg </a> <small>The default image presented by Matlab's image function has a very interesting undocumented story....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/auto-completion-widget" rel="bookmark" title="Auto-completion widget">Auto-completion widget </a> <small>Matlab includes a variety of undocumented internal controls that can be used for an auto-completion component. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/persisting-transparent-colors-in-hg2" rel="bookmark" title="Persisting transparent colors in HG2">Persisting transparent colors in HG2 </a> <small>We can set semi- and fully-transparent colors in HG2 for multiple graphic objects, but making these settings stick is non-trivial. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/uitable-cell-colors" rel="bookmark" title="Uitable cell colors">Uitable cell colors </a> <small>A few Java-based customizations can transform a plain-looking data table into a lively colored one. ...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/auto-scale-image-colors/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Images in Matlab uicontrols &#038; labels</title>
		<link>https://undocumentedmatlab.com/articles/images-in-matlab-uicontrols-and-labels?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=images-in-matlab-uicontrols-and-labels</link>
					<comments>https://undocumentedmatlab.com/articles/images-in-matlab-uicontrols-and-labels#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 17 Oct 2012 18:00:57 +0000</pubDate>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[Icons]]></category>
		<category><![CDATA[Low risk of breaking in future versions]]></category>
		<category><![CDATA[Stock Matlab function]]></category>
		<category><![CDATA[Undocumented feature]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[Pure Matlab]]></category>
		<category><![CDATA[uicontrol]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3177</guid>

					<description><![CDATA[<p>Images can be added to Matlab controls and labels in a variety of manners, documented and undocumented. </p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/images-in-matlab-uicontrols-and-labels">Images in Matlab uicontrols &amp; labels</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/icon-images-in-matlab-uicontrols" rel="bookmark" title="Icon images &amp; text in Matlab uicontrols">Icon images &amp; text in Matlab uicontrols </a> <small>HTML can be used to add image icons to Matlab listbox and popup (drop-down) controls. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/transparency-in-uicontrols" rel="bookmark" title="Transparency in uicontrols">Transparency in uicontrols </a> <small>Matlab uicontrols' CData property can be customized to provide background transparency....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-matlab-labels" rel="bookmark" title="Customizing Matlab labels">Customizing Matlab labels </a> <small>Matlab's text uicontrol is not very customizable, and does not support HTML or Tex formatting. This article shows how to display HTML labels in Matlab and some undocumented customizations...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/panel-level-uicontrols" rel="bookmark" title="Panel-level uicontrols">Panel-level uicontrols </a> <small>Matlab's uipanel contains a hidden handle to the title label, which can be modified into a checkbox or radio-button control...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>A couple of weeks ago, a reader <a target="_blank" href="/articles/html-support-in-matlab-uicomponents/#comment-110444">here</a> asked how to integrate images in Matlab labels. I see quite a few queries about this, so I wanted to take today&#8217;s opportunity to explain how this can be done, and how to avoid common pitfalls.<br />
In fact, there are two main methods of displaying images in Matlab GUI &#8211; the documented method, and the undocumented one:</p>
<h3 id="documented">The documented method</h3>
<p>Some Matlab uicontrols (buttons, radio and checkboxes) have the <a target="_blank" rel="nofollow" href="http://www.mathworks.co.uk/help/matlab/ref/uicontrol_props.html#bqxoijz"><b>CData</b></a> property that can be used to load and display an image. For example:</p>
<pre lang='matlab'>
imgData = imread('myImage.jpg');   % or: imread(URL)
hButton = uicontrol('CData',imgData, ...);
</pre>
<p>While label uicontrols (<i><b>uicontrol</b>(&#8216;style&#8217;,&#8217;text&#8217;, &#8230;)</i>) also have the <b>CData</b> property, it has no effect on these controls. Instead, we can create an invisible axes that displays the image using the <i><b>image</b></i> function.</p>
<h3 id="undocumented">The undocumented method</h3>
<h4 id="web">web-based images</h4>
<p>I&#8217;ve already written extensively about Matlab&#8217;s <a target="_blank" href="/articles/html-support-in-matlab-uicomponents/">built-in support for HTML</a> in many of its controls. The supported HTML subset includes the &lt;img&gt; tag, and can therefore display images. For example:</p>
<pre lang='matlab' escaped="true">
htmlStr = '<html><b>Logo</b>: <img decoding="async" src="https://undocumentedmatlab.com/images/logo_68x60.png"/></html>';
hButton = uicontrol('Position',[10,10,120,70], 'String',htmlStr, 'Background','white');
</pre>
<p><center><figure style="width: 150px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" alt="uicontrol with HTML image" src="https://undocumentedmatlab.com/images/button_image.png" title="uicontrol with HTML image" width="120" height="70" /><figcaption class="wp-caption-text">uicontrol with HTML image</figcaption></figure></center></p>
<h4 id="local">local images</h4>
<p>Note that the image src (filename) needs to be formatted in a URL-compliant format such as <code>'http://www.website.com/folder/image.gif'</code> or <code>'file:/c:/folder/subfolder/img.png'</code>. If we try to use a non-URL-format filename, the image will not be rendered, only a placeholder box:</p>
<pre lang='matlab' escaped="true">
uicontrol('Position',..., 'String','<html><img decoding="async" src="img.gif"/></html>');  %bad
uicontrol('Style','list', ... 'String',{...,'<html><img decoding="async" src="img.gif"/></html>'});  %bad
</pre>
<p><center><figure style="width: 170px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" alt="Ill-specified HTML images in Matlab uicontrols" src="https://undocumentedmatlab.com/images/html_noimg1.png" title="Ill-specified HTML images in Matlab uicontrols" width="70" height="70"/> <img loading="lazy" decoding="async" alt="Ill-specified HTML images in Matlab uicontrols" src="https://undocumentedmatlab.com/images/html_noimg2.png" title="Ill-specified HTML images in Matlab uicontrols" width="70" height="70"/><figcaption class="wp-caption-text">Ill-specified HTML images in Matlab uicontrols</figcaption></figure></center><br />
Instead, we need to use correct URI syntax when specifying local images, which means using the <code>'file:/'</code> protocol prefix and the <code>'/'</code> folder separator: <span id="more-3177"></span></p>
<pre lang='matlab' escaped="true">
>> iconsFolder = fullfile(matlabroot,'/toolbox/matlab/icons/');
>> iconUrl = strrep(['file:/' iconsFolder 'matlabicon.gif'],'\','/');
>> str = ['<html><img decoding="async" src="' iconUrl '"/></html>']
str =
<html><img decoding="async" src="file:/C:/Program Files/MATLAB/ ..... /icons/matlabicon.gif"/></html>
>> uicontrol('Position',..., 'String',str);
>> uicontrol('Style','list', ... str});
</pre>
<p><center><figure style="width: 170px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" alt="Correctly-specified HTML images in Matlab uicontrols" src="https://undocumentedmatlab.com/images/html_img.png" title="Correctly-specified HTML images in Matlab uicontrols" width="70" height="70"/> <img loading="lazy" decoding="async" alt="Correctly-specified HTML images in Matlab uicontrols" src="https://undocumentedmatlab.com/images/html_img2.png" title="Correctly-specified HTML images in Matlab uicontrols" width="70" height="70"/><figcaption class="wp-caption-text">Correctly-specified HTML images in Matlab uicontrols</figcaption></figure></center><br />
A similar pitfall exists when trying to integrate images in GUI control tooltips. I already discussed this issue <a target="_blank" href="/articles/spicing-up-matlab-uicontrol-tooltips/">here</a>.<br />
You can use HTML to resize the images, using the &lt;img&gt; tag&#8217;s <i>width, height</i> attributes. However, beware that enlarging an image might introduce pixelization effects. I discussed image resizing <a target="_blank" href="/articles/customizing-menu-items-part-3/#custom">here</a> &#8211; that article was in the context of menu-item icons, but the discussion of image resizing also applies in this case.</p>
<h4 id="labels">images in text labels</h4>
<p>As for text labels, since text-style uicontrols do not unfortunately support HTML, we can use the equivalent Java <code>JLabel</code>s, as I have explained <a target="_blank" href="/articles/customizing-matlab-labels/">here</a>. Here too, we need to use the <code>'file:/'</code> protocol prefix and the <code>'/'</code> folder separator if we want to use local files rather than internet files (http://&#8230;).</p>
<h4 id="java">Java customizations</h4>
<p>Using a uicontrol&#8217;s <a target="_blank" href="/articles/findjobj-find-underlying-java-object/">underlying Java component</a>, we can customize the displayed image icon even further. For example, we can specify a different icon for selected/unselected/disabled/hovered/pressed/normal button states, as I have explained <a target="_blank" href="/articles/button-customization/">here</a>. In fact, we can even specify a unique icon that will be used for the mouse cursor when it hovers on the control:<br />
<center><figure style="width: 170px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" src="https://undocumentedmatlab.com/images/cursor3.png" alt="Custom cursor" title="Custom cursor" width="84" height="44" /> <img loading="lazy" decoding="async" src="https://undocumentedmatlab.com/images/button_cursor_hand.png" alt="Custom cursor" title="Custom cursor" width="70" height="44" /><figcaption class="wp-caption-text">Custom uicontrol cursors</figcaption></figure></center></p>
<h4 id="R2019b">R2019b and newer</h4>
<p>Iin R2019b and later, unless you specify the image size nothing will be shown. A solution is presented in <a href="https://www.mathworks.com/matlabcentral/answers/497260-figure-uitable-does-not-display-html-image-in-2019b#answer_411812" rel="nofollow" target="_blank">this answer</a></p>
<pre lang="Matlab">str = ['<html><img loading="lazy" decoding="async" src="file:/' iconUrl '" height="16" width="16"></html>'];</pre>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/images-in-matlab-uicontrols-and-labels">Images in Matlab uicontrols &amp; labels</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/icon-images-in-matlab-uicontrols" rel="bookmark" title="Icon images &amp; text in Matlab uicontrols">Icon images &amp; text in Matlab uicontrols </a> <small>HTML can be used to add image icons to Matlab listbox and popup (drop-down) controls. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/transparency-in-uicontrols" rel="bookmark" title="Transparency in uicontrols">Transparency in uicontrols </a> <small>Matlab uicontrols' CData property can be customized to provide background transparency....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-matlab-labels" rel="bookmark" title="Customizing Matlab labels">Customizing Matlab labels </a> <small>Matlab's text uicontrol is not very customizable, and does not support HTML or Tex formatting. This article shows how to display HTML labels in Matlab and some undocumented customizations...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/panel-level-uicontrols" rel="bookmark" title="Panel-level uicontrols">Panel-level uicontrols </a> <small>Matlab's uipanel contains a hidden handle to the title label, which can be modified into a checkbox or radio-button control...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/images-in-matlab-uicontrols-and-labels/feed</wfw:commentRss>
			<slash:comments>29</slash:comments>
		
		
			</item>
		<item>
		<title>Image Easter egg</title>
		<link>https://undocumentedmatlab.com/articles/image-easter-egg?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=image-easter-egg</link>
					<comments>https://undocumentedmatlab.com/articles/image-easter-egg#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 06 Apr 2010 17:28:44 +0000</pubDate>
				<category><![CDATA[Low risk of breaking in future versions]]></category>
		<category><![CDATA[Stock Matlab function]]></category>
		<category><![CDATA[Undocumented feature]]></category>
		<category><![CDATA[Easter egg]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[Pure Matlab]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1272</guid>

					<description><![CDATA[<p>The default image presented by Matlab's image function has a very interesting undocumented story.</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/image-easter-egg">Image Easter egg</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/spy-easter-egg" rel="bookmark" title="Spy Easter egg">Spy Easter egg </a> <small>The built-in Matlab function spy has an undocumented feature (Easter egg) when it is called with no input arguments....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/spy-easter-egg-take-2" rel="bookmark" title="Spy Easter egg take 2">Spy Easter egg take 2 </a> <small>The default spy Easter-egg image in the spy function has recently changed. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/auto-scale-image-colors" rel="bookmark" title="Auto-scale image colors">Auto-scale image colors </a> <small>Images can be automatically color-scaled for maximum resolution, using the undocumented MarkedClean event. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/plot-legend-title" rel="bookmark" title="Plot legend title">Plot legend title </a> <small>Titles to plot legends are easy to achieve in HG1 (R2014a or earlier), but much more difficult in HG2 (R2014b or newer). ...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>Last year I presented the Matlab <a target="_blank" href="/articles/spy-easter-egg/">Spy Easter egg</a> for the 2009 Easter holiday. This year, slightly late, I present another Easter egg in the well-known <i><b>image</b></i> function: When we run <i><b>image</b></i> with no input arguments, we get a default image of an inverted boy:</p>
<pre lang="matlab">image;</pre>
<p><center><figure style="width: 437px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" alt="Default image" src="https://undocumentedmatlab.com/images/image1.png" title="Default image" width="437" height="396" /><figcaption class="wp-caption-text">Default image</figcaption></figure></center><br />
To see the image right-side up:</p>
<pre lang="matlab">
image;
colormap(gray(32));
axis ij image off
</pre>
<p><center><figure style="width: 437px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" alt="Corrected default image" src="https://undocumentedmatlab.com/images/image2.png" title="Corrected default image" width="437" height="396" /><figcaption class="wp-caption-text">Corrected default image</figcaption></figure></center><br />
In fact, it turns out that there are quite a few hidden super-imposed images here, and that there is an interesting story behind them, which was <a target="_blank" rel="nofollow" href="http://blogs.mathworks.com/steve/2006/10/17/the-story-behind-the-matlab-default-image/">explained by Steve Eddins in his Image Processing blog</a>. For those interested, the boy above is Steve&#8217;s eldest, but that&#8217;s only a small part of the story&#8230;<br />
Happy Holiday!<br />
Yair<br />
p.s. &#8211; The default image has not changed in many years. I guess the boy should be in high school or college by now. Perhaps it&#8217;s time to post an updated picture in the R2010b release, Steve?</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/image-easter-egg">Image Easter egg</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/spy-easter-egg" rel="bookmark" title="Spy Easter egg">Spy Easter egg </a> <small>The built-in Matlab function spy has an undocumented feature (Easter egg) when it is called with no input arguments....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/spy-easter-egg-take-2" rel="bookmark" title="Spy Easter egg take 2">Spy Easter egg take 2 </a> <small>The default spy Easter-egg image in the spy function has recently changed. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/auto-scale-image-colors" rel="bookmark" title="Auto-scale image colors">Auto-scale image colors </a> <small>Images can be automatically color-scaled for maximum resolution, using the undocumented MarkedClean event. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/plot-legend-title" rel="bookmark" title="Plot legend title">Plot legend title </a> <small>Titles to plot legends are easy to achieve in HG1 (R2014a or earlier), but much more difficult in HG2 (R2014b or newer). ...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/image-easter-egg/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
