March 24, 2011

Evaluating ratio meat/fat: an image analysis example

We would like to compute how lean is a piece of meat based entirely on the photograph. Practically, this task should be done with a hand-held device. HP Slate was used with Pixcavator installed.

A similar analysis was done before, with images copied from the internet. This time the images are taken by myself with the tablet’s camera. I bought the meat too myself at the local Kroger:

“PVT selection angus choice boneless beef ribeye steak”, 0.56 lb, $5.59.

Finding the right settings took just a few seconds. I only had to move one slider, the contrast.

The amount of meat is captured by the red contours above. The screenshot is below.

As you can see in the right bottom, (the area of) the meat is about 42% of the whole image.

Now we need to capture the fat. It’s tempting to try to do it directly but capturing light area with white background is never a good idea. It’s much easier to get the whole thing and then do some math.

The total of the whole steak (meat and fat) is about 57% of the total image.

Hence, the amount of fat is (57-42)/57, or about 26%. Not lean!

 Other image analysis examples

March 6, 2011

How I use tablets

Filed under: education,image processing/image analysis software,mathematics,site — Peter Saveliev @ 9:36 pm

I use SMART Tablet PC with Windows Journal in class. This means that I write on the screen of the tablet with a digital pen and the writing instantly appears on the screen for the students to see.

lecture with tabletlecture with tablet

The result is

  • handwriting in bright blue, with other colors used for emphasis;
  • formulas broken into parts based on color;
  • colorful illustrations, copied as many times as necessary to show progress.

In any way it’s better than either chalkboard or PowerPoint.

I found SMART Tablet quite reliable.

In the end of the lecture, the file is immediately published in the pdf format to the class web page.

I use HP Slate to edit the lectures afterward.

HP Slate is a Windows computer in the tablet format.

I use it to correct, clean, extend the lectures to make them more readable. Eventually the lectures are transcribed into articles that you see on this site.

I also I use the tablet for mobile image analysis with Pixcavator (more on that in a later post) and for web surfing.

Observations:

  • Responsiveness is good for web, adequate for writing.
  • The buttons are just a bit too small for my (average sized) fingers.
  • The pen has to be kept close to vertical for writing and drawing.
  • Resting your hand on the screen might produce lines.
  • Smaller, thicker, and heavier than iPad.

February 24, 2011

Math online

Filed under: education,mathematics — Peter Saveliev @ 5:52 pm

Places to find math:

Type of site Examples Is it useful as a course? Is it useful as a reference? Is it fun?
Video lectures Khan Academy, MIT OpenCourseWare, YouTube
Yes
No
Some
Questions and answers MathOverflow, StackExchange
No
No
Some
Online books Computer Vision Primer, Hatcher’s topology book
Yes
Yes
Some
Lecture notes Online lecture notes
No
No
No
Encyclopedias Wikipedia, PlanetMath, Wolfram MathWorld
No
Yes
No

February 19, 2011

More uses of our image analysis software in research

Filed under: image processing/image analysis software,news — Peter Saveliev @ 5:03 pm

A few more academic papers have been published that use Pixcavator for image analysis. An amazing variety of fields!

  • Eman Abdelzaher, Ibtesam AbdelReheem, Madiha Hassan, Aml Abd-Elhameed, and Dalia Kamal, Effects of angiotensin converting enzyme inhibitors, peroxisome proliferators activated receptor  γ agonists, and statins on a rat model of hypertension, Bulletin of Alexandria Faculty of Medicine, Vol 46, No 3 (2010).
  • DSVGK Kaladhar and Siva Kishore Nandikolla, Antimicrobial studies, biochemical and image analysis in mirabilis jalapa, International Journal Of Pharmacy&Technology, Sep-2010, Vol. 2, Issue No.3, 683-693.
  • Andres Salcedo, Angel Del Valle, Barbara Sanchez, Victor Ocasio, Amaury Ortiz, Pedro Marquez, and Dimuth Siritunga, Comparative evaluation of physiological post-harvest root deterioration of 25 cassava (Manihot esculenta) accessions: visual vs. hydroxycoumarins fluorescent accumulation analysis, African Journal of Agricultural Research Vol. 5(22), pp. 3138-3144, 18 November, 2010.
  • DSVGK Kaladhar,Studies and affects on biospere due to spiderdegrading fungi, International Journal of Pharmaceutical Sciences Review and Research, Volume 6, Issue 1, January – February 2011.
  • Felix N. Okonta and S. G. Magagula, Railway Foundation Properties of Some South African Quarry Stones, The Electronic Journal of Geotechnical Engineering, Volume 16 [2011] Bundle A, pp. 179-197.
  • Dharmendra K. Maurya, Nivedita Nandakumar, and Thomas Paul Asir Devasagayam, Anticancer property of gallic acid in A549, a human lung adenocarcinoma cell line, and possible mechanisms, Journal of Clinical Biochemistry and Nutrition, 2011 January; 48(1): 85–90.
  • Douglas Blackiston, Dany S. Adams, Joan M. Lemire, Maria Lobikin, and Michael Levin, Transmembrane potential of GlyCl-expressing instructor cells induces a neoplastic-like conversion of melanocytes via a serotonergic pathway, Disease Models and Mechanisms, 2011 January; 4(1): 67–85.

The rest is here.

February 14, 2011

Google confuses topology and topography

Filed under: education,mathematics,rants — Peter Saveliev @ 1:07 am

Google doesn’t know the difference between topology and topography, or at least definies the former via the latter. That’s just pathetic! 

Image:Google confuses topology and topography.png

February 12, 2011

Topology, Algebra, and Geometry explained with donuts

Filed under: education,mathematics — Peter Saveliev @ 11:52 am

I tried to illustrate the relation between Topology, Algebra, and Geometry using delicious donuts.

image:topology-algebra-geometry.png

It may be seem strange to some that topology is related to counting but consider the fact that the key step here is to recognize that these are separate – disconnected — objects! (There are also two holes.) As you can see both computing and measuring have to rely on counting, at least initially. So, yes, topology comes first.

February 7, 2011

Computational science training: research with undergraduates

It’s time again to announce that the students’ applications for participation in the grant “REU Site: Computational Science Training at Marshall University for Undergraduates in the Mathematical and Physical Sciences” are being accepted. Over the summers of 2010–2012, the Departments of Mathematics, Physics, and Chemistry at Marshall University will jointly host twelve students for ten weeks of instruction and research in computational science.

The general goal is to do something new computationally while learning some math. These are the two that I supervised last summer:

 They correspond to the first two items on this new set for 2011:

  • Digital image analysis
  • Topological data analysis
  • Image-to-image search
  • Modeling with discrete exterior calculus

Details here. Please contact me if you have any equations.

February 2, 2011

Pixcavator DLL released

Filed under: image processing/image analysis software,mathematics,software releases — Peter Saveliev @ 12:11 pm

As a joint product of Intelligent Perception and AssaySoft Inc. we release Pixcavator DLL.

This library supplies the developer with a basic tool for image analysis and computer vision. The output contains the most fundamental data about the image: a list of all objects in the image along with their measurements, locations, and other characteristics. The DLL allows anyone with Microsoft Visual Studio to create new software based on the methods presented in this site. To understand the algorithms, read Grayscale Images.

This is how DLL works:

The image analysis part is hidden from the developer who is simply supplied with the output data.

Essentially, we take care of the math for you and let you concentrate on:

  • user interface,
  • file management,
  • data management,
  • domain knowledge.

The package provides programmatic access to the low level image processing algorithms employed in our popular image analysis software. These methods have been proven in numerous applications.

This package can be used as a component in a variety of software for image analysis applications. You can think of it as a plug-in. It is a VS C# solution.

The package contains just two DLLs and a short description. Its operation is also very simple.

More information will be posted here.

January 29, 2011

Lengths of curves: theoretical aspects

Filed under: education,image processing/image analysis software,mathematics — Peter Saveliev @ 4:09 pm

The subject of lengths of curves in the digital envisonment has been discussed here several times. It’s summarized here: http://inperc.com/wiki/index.php?title=Lengths_of_curves. The main idea to take home is that no matter how high the resolution of your image is, the relative error of the measurement of the length of a “real” curve as approximated by a “digital” curve remains constant. That’s bad news for computing the perimeter or the roundness of an object in the image.

The perimeter of a square and that of the inscribed circle are the same.

The perimeter of a square and that of the inscribed circle are the same.

A broader explanation for this failure is that the geometry of the universe is independent of direction, i.e. isotropic. By adding the grid and limiting our curves to it we make our approximation of this universe anisotropic. As the examples show, the horizontal and vertical directions are different from the rest. And no matter how much we improve this approximate universe by making the grid finer and finer, it will remain anisotropic. Choosing a triangular or hexagonal grid or other tricks won’t help.

The result is counter-intuitive. Indeed, refining the approximation has to lead to the exact result. Actually, there is a moment in calc1, when the issue arises and it requires some careful thinking.

The issue comes up when the definition of the Riemann integral is introduced. The integral is defined as the “limit” of Riemann sums, but what sums? They may be initially defined as a sums over intervals of equal length. In this case there is only one parameter and it may seem that you are just dealing with the same limits as the ones used for continuity, derivatives etc. However, this definition is inadequate if you want to prove some simple properties of the integral. Turns out, you need to be able to deal with arbitrary partitions of the interval. Then the Riemann integral is still a limit but a limit of Riemann sums over all possible subdivisions of the interval. For continuous functions it does not matter (you have to prove that), but for some other functions is does. These functions are non-integrable. The issue is often glossed over in a standard Calculus class (so that not to traumatize the students).

A similar situation here. We need to consider all possible rectangular grids. Then take the limit. The limit will be a two-parameter kind: the width of the pixel and its height go to 0, independently. Then, when both are smaller than some delta, the length of the approximated curve will be within some given epsilon from the length of the “real” curve. Problem solved!

Solved? It’s unclear how to use this insight to improve the accuracy…

January 28, 2011

Electronic Imaging conference

Filed under: image processing/image analysis software,mathematics,news — Peter Saveliev @ 1:06 pm

I attended the Electronic Imaging conference this week in San Francisco, organized by IS&T/SPIE.

When I was getting ready I tried to figure out what talks to attend. This is what I discovered:

Very sad!

Turns out, there were a few mostly mathematical talks…

Gave my talk: Graph non-tree representation of the topology of gray scale images. It was based on the paper under the same name but I also added some more recent stuff about analysis of color images (still to some).

Gave a demonstration of Pixcavator, Pixcavator image-to-image search, and Pixcavator mobile (still to come). The demo session was an especially fun part with a lot to see and a lot of people to talk with.

January 12, 2011

Tineye image search still can’t handle rotated versions

Filed under: computer vision/machine vision/AI,image search,reviews — Peter Saveliev @ 3:48 pm

In spite of prior assurances, Tineye still can’t find rotated versions of images.

Original:

image:tineye honda.jpg

Rotated:
image:tineye honda rotated.jpg

Other image-to-image search engines here

January 11, 2011

Computational topology short course

Filed under: computer vision/machine vision/AI,education,mathematics — Peter Saveliev @ 11:12 am

It was a part of the annual Joint Mathematics Meeting in New Orleans.

 

Lectures:

  1. Topological Data Analysis by Afra Zomorodian
  2. Persistent Topology by Gunnar Carlsson
  3. Topological Dynamics: Rigorous Numerics via Cubical Homology by Marian Mrozek
  4. Euler Calculus for Sensor Data by Robert Ghrist
  5. Topology in Robotics: Planning with Uncertainty by Michael Erdmann
  6. Optimization of Cycles and Bases by Jeff Erickson

Analysis of digital images wasn’t discussed. Fortunately, I just finished a draft of a paper on this exact subject. It’s called Homology groups of filtrations. Broadly, this is my view on persistent homology.

December 21, 2010

Seurat’s painting and persistent homology

Filed under: image processing/image analysis software,mathematics — Peter Saveliev @ 4:15 pm

From a recent article in the Notices of the AMS “What is persistent homology?”: ” Consider the art of Seurat or a piece of old newsprint. The eye, or the brain, performs the marvelous task of taking the sense data of individual points and assembling them into a coherent image of a continuum — it infers the continuous from the discrete.”

The articles goes on to explain how topologists have learned to deal with noise and uncertainty of real life images and data. The tool is called persistent homology. The article explains some of the mathematics but not how exactly this approach applies to the painting.

I’ll try to analyze this image with Pixcavator.

First, I had to choose a color channel. The reason is that true color analysis is still impractical (also multiparameter persistence isn’t well understood).

Whatever the channel is, the result is a gray scale image. In this case,

 persistence = contrast.

I decided to concentrate on contrast only and see how far using only topological tools can take us. Not far.

In the first experiment, I chose “Blue”. Then I allowed myself to move only the “contrast” slider and tried to isolate the sail with least amount of noise left. The first image below is the result. A lot of small specs all around. Moving the slider further to the right would merge the sail with the background. Now, if you are allowed to filter out objects based on their sizes, the result is much better, second image. Much less noise and, in addition to the sail, the leaves and the shore line are captured too.

In the second experiment, I chose “Green”. Once again, I allowed myself to move only the “contrast” slider and tried to isolate the rower in the rowing boat, with least amount of noise left. Same story.

The results aren’t surprising at all. One sees similar results as salt-and-pepper noise, which is common in imaging, will have high contrast.

So, the bottom line is you can’t rely entirely on contrast/persistence and ignore geometry.

Of course, color image analysis might produce better results.

December 18, 2010

Colorant dispersion: an image analysis example

Filed under: image processing/image analysis software — Peter Saveliev @ 2:52 pm

Q: “I was unable to isolate the small black dots exclusive of the horizontal bands of color. Do you think it is possible to isolate only the black dots and recognize only them?”

I ran just the first image so far. The goal, as I understand it, is to capture the two small dots on the right. The way to get them is to search for small, dark, high contrast objects. Unfortunately, the letters in the label are exactly like that — black on white. So, I just cropped the image. Then, I tried to set a low limit on the size and high limits on contrast and average contrast. After a bit of trial and error I found limits that work: 20, 60, and 12. The screenshot shows that the dots are captured. There are also other contours shown — of large objects. To see the locations etc of the dots, I clicked (twice) on the top of the “Size” column in the output table to arrange the rows in the order of increasing size/area. As a result, the two dots are at the top of the list, #13 and 14.

Image:Colorant dispersion screenshot.jpg

More here

December 8, 2010

Discrete Calculus: Applied Analysis on Graphs for Computational Science by Grady and Polimeni

Filed under: education,mathematics,reviews — Peter Saveliev @ 3:35 pm

Discrete Calculus: Applied Analysis on Graphs for Computational Science by Leo J. Grady, Jonathan R. Polimeni [1]

Description: “The field of discrete calculus, also known as “discrete exterior calculus“, focuses on finding a proper set of definitions and differential operators that make it possible to operate the machinery of multivariate calculus on a finite, discrete space. In contrast to traditional goals of finding an accurate discretization of conventional multivariate calculus, discrete calculus establishes a separate, equivalent calculus that operates purely in the discrete space without any reference to an underlying continuous process.”

Best quote:

 Calculus is topology.

The reason is that the matrix of the exterior derivative is simply the transpose of the matrix of the boundary operator. The fact is well-known but I never saw the depth of this connection. The practical consequences are also significant. Indeed, if you know the boundary of each k-cell in a cell complex in terms of (k-1)-cells, you also know the exterior derivative of all discrete differential forms (co-chains). So, you know calculus.

This idea inspired me to come up with a formula of my own:

 calculus / algebra = topology.

Roughly, you can take all linear algebra out of calculus via a certain equivalence relation (cohomology). What you end up with is Betti numbers.

There will be a few more remarks here

« Previous PageNext Page »