Rounding of strings

April 23, 2013

Consider the following program:

int main()
{
auto f = 1.0f;
printf(“%f\n”, f / 0);
printf(“%.1f\n”, f / 0);
printf(“%.2f\n”, f / 0);
printf(“%.3f\n”, f / 0);
printf(“\n”);

f = 0.0f;
printf(“%f\n”, f / 0);
printf(“%.1f\n”, f / 0);
printf(“%.2f\n”, f / 0);
printf(“%.3f\n”, f / 0);
}

With Visual Studio 2012, it outputs the following:

1.#INF00
1.$
1.#J
1.#IO

-1.#IND00
-1.$
-1.#J
-1.#IO

The strings are also rounded! That is, ‘#’ + 1 == ‘$’. This can be a bit surprising.

 


Graph cuts in nVidia’s NPP toolbox (imageSegmentationNPP)

February 18, 2013

Note: This post has been updated after I received some help from nVidia’s Timo Stich. It turned out that some weights have to be set to zero; otherwise, CUDA gives an incorrect answer.

Today, I downloaded the latest version of nVidia’s CUDA to try out the graph cut segmentation present in NPP.

There is an example called “imageSegmentationNPP” which solves a two-dimensional (4-connected) problem. These are the results I got:

GPU: 84 ms.
CPU (GridCut): 24 ms.
Read the rest of this entry »


GridCut

June 15, 2012

I have briefly tried the GridCut code (http://gridcut.com) and performed the same experiments as in the previous post. Below are the updated graphs.

The GridCut code performs very well for graphs with a reasonable amount of regularization, but becomes very slow for a high amount of regularization, just as BK.


Cell Classification

May 10, 2012

Johannes Ulén, Fredrik Kahl and I recently worked on a data set from the ICPR Contest on HEp-2 Cells Classification. The task is to classify images of cells as one of six possible categories. The image below show examples from the data set:

Each row shows images from one class.

Each row shows randomly selected images from one class. Click to enlarge.

Read the rest of this entry »


Maximum flow for vision

January 30, 2012

Last week, I decided to try out the IBFS maximum flow algorithm for vision applications for the first time. The algorithm is due to A.V. Goldberg, S.Hed, H. Kaplan, R.E. Tarjan, and R.F. Werneck, who have released an implementation which uses the same interface as the commonly used algorithm by Boykov and Kolmogorov.

My test was very simple, I generated a 128×128 8-connected grid graph, with source and sink arcs computed from the ‘cameraman’ image. I then let the weights of the arcs between the nodes vary several orders of magnitude. The result is quite telling:

The BK algorithm takes over 100 seconds to compute the maximum flow when the regularization is high. By contrast, the IBFS algorithm always uses less than 1 second. Here is the logarithmic plot:


Inpainting with coherency sensitive hashing

December 12, 2011

Coherency Sensitive Hashing (CSH) is a method to find corresponding patches between images quickly. It was introduced at this year’s ICCV. Since the authors have made their source code available, I decided to spend Sunday afternoon to play a little with their code.

Since there is no inpainting experiments in their paper and I could not find any example code for inpainting with PatchMatch either, I decided to implement this. The result was a Matlab function, which, given an RGB image and a mask, tries to fill the region specified by the mask with content from the rest of the image.

Example

My source code is available on Github.

The results are not quite as good as shift-map inpainting, which we have implemented before.


Optimization for Multi-Region Segmentation of Cardiac MRI

August 22, 2011

Johannes Ulén, Fredrik Kahl and I have a paper accepted to STACOM, a workshop held in conjunction with MICCAI 2011 in Toronto.

The paper, “Optimization for Multi-Region Segmentation of Cardiac MRI”, is based on Andrew Delong and Yuri Boykov’s multi-region paper from ICCV 2009. We segment the left and right ventricles, myocardium and the papillary muscles jointly.

Read the rest of this entry »