In this post, I'll explore how imshowpair and imfuse work.Reason: I was curious.Last month, I wrote about registering several hand-held photographs together. In that post, I used imshowpair several... read more >>

]]>In this post, I'll explore how imshowpair and imfuse work.Reason: I was curious.Last month, I wrote about registering several hand-held photographs together. In that post, I used imshowpair several times.Here are two of the images:A = imread('A.jpg');imshow('A.jpg')B = imread('B.jpg');imshow(B)And here is imshowpair in use:imshowpair(A,B)I wanted to know how this function works. Today, I thought I would share with you what I found and how I found it.Many functions in Image Processing Toolbox ship as MATLAB source code. When this is the case, I always start my code exploration by using the Debugger to follow the code as it executes, a step at a time. Here is the beginning of my code dive:The first thing I notice is that the parsed input arguments are all passed along immediately to imfuse. A few lines later, the results from imfuse are displayed using imshow.Aha! The function imfuse must be really how this is all computed. So, I continue to follow execution in the Debugger by stepping

...read more >>

]]>The typical modern French* horn, pictured below, has about 23 total feet of tubing. At the beginning and the end, the tubing is conical. In the middle, the tubing is cylindrical.Depending on which... read more >>

]]>The typical modern French* horn, pictured below, has about 23 total feet of tubing. At the beginning and the end, the tubing is conical. In the middle, the tubing is cylindrical.Depending on which valve levers are pressed, a player might be buzzing into single tube that is anywhere from 9 feet to 17 feet long (approximately). For a personal project, I wanted to create a visual illustration of these various lengths. I used an extension pole and got some help in taking several pictures. My helper used a handheld phone.A = imread('A.jpg');B = imread('B.jpg');C = imread('C.jpg');tiledlayout(2,2)nexttileimshow(A,'Interpolation','bilinear')title('Image A (length of F horn, 12 feet)')nexttileimshow(B,'Interpolation','bilinear')title('Image B (length of B-flat horn, 9 feet)')nexttileimshow(C,'Interpolation','bilinear')title('Image C (length of B horn, 17 feet)')I wanted to use these pictures to make a composite that lets you visually compare the three pole lengths. The problem is that these

...read more >>

]]>A question on MATLAB Answers caught my eye earlier today. Borys has this pseudocolor image of a weighted adjacency matrix: And he has this image of the color scale: Borys wants to know how to compute... read more >>

]]>A question on MATLAB Answers caught my eye earlier today. Borys has this pseudocolor image of a weighted adjacency matrix:

And he has this image of the color scale:

Borys wants to know how to compute the real adjacency matrix from this image, knowing that the color scale represents the range [0,5].

The problem looked interesting to me, and I wanted to give it a try.

image_url = "https://www.mathworks.com/matlabcentral/answers/uploaded_files/410520/image.png"; scale_url = "https://www.mathworks.com/matlabcentral/answers/uploaded_files/410525/image.png"; A = imread(image_url);Here is my planned approach:

1. Use the white squares to determine the grid of coordinates for the cells of the adjacency matrix.

2. Extract the

...read more >>

]]>I wrote previously about the new colorChecker, which can detect X-Rite test charts in the R2020b release. Another area of new color-related functionality is computing perceptual color differences.... read more >>

]]>I wrote previously about the new colorChecker, which can detect X-Rite test charts in the R2020b release. Another area of new color-related functionality is computing perceptual color differences. There is the new function deltaE, which computes color differences based on the L*a*b* color space and the CIE76 standard. There is also the imcolordiff function, which can compute color differences based either on the CIE94 or the CIEDE2000 standard.

I recently mentioned to someone on the Image Processing Toolbox team that I was planning to write a blog post about these functions, and he posed the following question: which two colors are the furthest apart, perceptually speaking? I decided to give that a try using $\Delta_E$. I'll formulate the problem this way: which two sRGB colors have the largest $\Delta_E$ between them?

In a related post back in 2015, I demonstrated how

...read more >>

]]>Lately, I've been spending more time on MATLAB Central, and I'd like to encourage you to try out some of the resources there, if you haven't already.

Have you heard of Cody? It is an addictive MATLAB puzzle-solving activity. You can learn a lot about MATLAB and algorithm coding approaches by trying the problems there, and especially by looking at other people's solutions. There's a competitive aspect as well, as your puzzle solutions get scored and ranked against other solutions. (In the Cody world, smaller programs get the better scores.)

This morning, for example, this Cody problem attracted my attention:

Problem 340. Find the last non-zero in a given dimension

You are given a logical matrix BW of any dimension, and a dimension dim . You need to find the locations of the last

...read more >>

]]>When I saw this picture, I was really tempted to take it into the local garden nursery and ask them how to keep color checker charts out of my rhododendrons. No, no, this post is not really about... read more >>

]]>When I saw this picture, I was really tempted to take it into the local garden nursery and ask them how to keep color checker charts out of my rhododendrons.

No, no, this post is not really about protecting gardens against unusual invaders. I was looking over the just-released R2020b Image Processing Toolbox, and I noticed that a number of color science related features made it into the release. Since I was posting about color a couple of months ago, I thought I would highlight some of these new features here. Today, I'll start with a function that can detect the location of an X-Rite® ColorChecker® chart into the workspace.

First, let's read our test image. This file contains the image shown above.

A = imread('colorCheckerTestImage-with-credit.jpg');Next, create a colorChecker object from the image.

chart = colorChecker(A) chart = colorChecker with properties: Image: [1024×1541×3 uint8]...read more >>

]]>Recently, I've been explaining how I made this plot, which is from DIPUM3E (Digital Image Processing Using MATLAB, 3rd ed.): In my July 20 post, I showed one way to compute the spectral colors to... read more >>

]]>Recently, I've been explaining how I made this plot, which is from DIPUM3E (Digital Image Processing Using MATLAB, 3rd ed.):

In my July 20 post, I showed one way to compute the spectral colors to display below the x-axis. Today I'll finish up by explaining the use of the colorbar function. These techniques are used in the DIPUM3E functions spectrumBar and spectrumColors, which are available to you in MATLAB Color Tools on the File Exchange and on GitHub. The entire set of DIPUM3E

...read more >>

]]>I was looking at these two numbers the other day:$0.01$$\frac{5764607523034235}{576460752303423488}$It turns out they are very close, differing only by about 5 parts in a quadrillion.A tech support... read more >>

]]>I was looking at these two numbers the other day:

$0.01$

$\frac{5764607523034235}{576460752303423488}$

It turns out they are very close, differing only by about 5 parts in a quadrillion.

A tech support case caught my attention on that day because MATLAB creator Cleve Moler (Numerical Computing with MATLAB, Experiments with MATLAB, Cleve's Laboratory, Cleve's Corner) responded to it, and I always enjoy Cleve's explanations.

The tech support case turned out to be related to understanding how floating-point numbers work. In part of his response, Cleve said, "1.e-2 is not one-hundredth; it is the floating point number nearest

...read more >>

]]>It was a while ago now, but on April 27 I started explaining how I made this plot, which is from **DIPUM3E** (*Digital Image Processing Using MATLAB*, 3rd ed.):... read more >>

It was a while ago now, but on April 27 I started explaining how I made this plot, which is from DIPUM3E (Digital Image Processing Using MATLAB, 3rd ed.):

In today's follow-up, I'll discuss how I computed the colors of the spectrum to display below the x-axis. I will use and refer to several DIPUM3E functions. These are available to you in MATLAB Color Tools on the File Exchange and on GitHub. The entire set of DIPUM3E functions is also on

...read more >>

]]>The new edition of Digital Image Processing Using MATLAB (DIPUM3E) contains a number of MATLAB functions related to color, color calculations, and color visualization. I wrote about functions for... read more >>

]]>The new edition of Digital Image Processing Using MATLAB (DIPUM3E) contains a number of MATLAB functions related to color, color calculations, and color visualization. I wrote about functions for displaying color swatches in my March 10 post. You can find some of the functions in MATLAB Color Tools on the File Exchange, as well as in the GitHub repository containing the MATLAB source code for the book.

A MathWorks friend asked me, earlier this year, why I chose to write the specific color-related functions that I did. The answer is that I wrote the functions that would help tell the story I wanted to tell. For example, I wanted to talk early in the chapter about the

...read more >>

]]>