Search Comments and Ratings

go

   
Date File Comment by Comment Rating
03 Apr 2014 K-medoids K-medoids clustering algorithm Author: Mo Chen Joao Henriques

Simple and elegant code, thanks!

03 Mar 2014 Worker Object Wrapper Simplifies managing resources such as large data within PARFOR loops and SPMD blocks Author: Parallel Computing Team Joao Henriques

Works well, thanks!

It does consume a fair bit amount of memory though. Since "random access constant data" seems to be the most common model for many data-intensive applications, it would be great if Matlab somehow supports read-only shared memory across labs in the future.

29 Dec 2013 Insomnia: prevent computer sleep mode This small utility prevents, on Windows computers, the automatic sleep mode. Author: Francesco Montorsi Joao Henriques

Awesome work! I added this to my startup.m and finish.m files so that the computer doesn't sleep when I have MATLAB open (since I'm usually doing some heavy number-crunching).

23 Oct 2013 textborder - Higher contrast text using a 1-pixel-thick border Draws text on a figure with a 1-pixel-thick border. Author: Joao Henriques Joao Henriques

Hi Colin, I tried your code on R2012a but can't reproduce the bug.

I also developed the code on R2008b and used it with "surface" objects, of which "pcolor" is one example, and had no problems as well.

It must be a MATLAB bug in the specific version you're using. Which one is it?

13 Jun 2013 Modified CMRmap Produces a colour colormap, of arbitrary length, that is monochrome-compatible. Author: Christopher Hummersone Joao Henriques

05 Feb 2013 Recursive directory listing - Enhanced RDIR Files and directories listing, including recursive and other special features Author: Thomas Vanaret Joao Henriques

10 Dec 2012 Improved Nystrom Kernel Low-rank Approximation efficient, self-complete implementation of improved Nystrom low-rank approximation Author: Kai Joao Henriques

Works as advertised! To train a linear SVM in the Nystrom feature-space, replace the computation of G and Ktilde at the end of INys() with:

M = Ve(:,pidx) * inVa;
Mdata = E * M;

then train SVM with Mdata (which has all training samples in the new feature space). To compute the same features for a test vector z, use:

Mz = exp(-sqdist(z', center')/kernel.para) * M;

and classify with the same linear SVM.

12 Feb 2012 disptable - Display matrix with column or row labels Displays a matrix with per-column or per-row labels. Author: Joao Henriques Joao Henriques

I'm glad you found it useful! It certainly makes console output much more appealing, that's why I shared it :)

I think what you mean in your example code is:
>>disptable(exmplematrix,S,'A|B|C|D')

Notice that S is a variable, not a string.

But you're right, there's a small bug with cell arrays. I should have tested that case better. I'm updating the file, but if you don't want to wait, it's simple: just replace iscellarray with iscellstr (it appears 2 times in the file). That's all!

16 Dec 2011 maximize Platform independent function to maximize a figure window. Author: Oliver Woodford Joao Henriques

Works as advertised, thank you!

27 Oct 2011 Fast edges of a color image (actual color, not converting to grayscale) Edges of a color image by the max gradient method. Author: Joao Henriques Joao Henriques

Anyway, this is an interesting topic but I haven't studied it extensively, so if at times I seem out of touch I apologize :)

27 Oct 2011 Fast edges of a color image (actual color, not converting to grayscale) Edges of a color image by the max gradient method. Author: Joao Henriques Joao Henriques

I didn't implement Simmoncelli's, but it's not surprising that the 5-point stencil is worse.

The estimation window is thin (5x1 or 1x5); it was really made for one-dimensional cases. It will be highly dependent on the direction of the axes, which makes it noisy.
(I assume you're not talking about the other 5-point stencil, which computes the Laplacian, not a directional derivative.)

The idea behind the Sobel and Prewitt filters is to take a simple difference estimator and blur it in 2 dimensions (ie, low-pass filter). The blurring is mostly isotropic, unlike 5-point stencil that gives high preference to one dimension/axis (x or y).

Following that line of reasoning, I tried convolution of a difference operator and a gaussian; it has good results and you can vary the sigma. Here's the code (also sobel and 5-point, commented out).

% yfilter = fspecial('sobel');
% yfilter = [-1, 8, -8, 1]' / 12;
sigma = 0.5;
yfilter = imfilter(fspecial('gaussian', ceil(sigma * 6), sigma), [1; 0; -1]);

09 Oct 2011 Fast edges of a color image (actual color, not converting to grayscale) Edges of a color image by the max gradient method. Author: Joao Henriques Joao Henriques

Since some people asked by e-mail, here's more insight into the algorithm:

This seems to be an old technique and it's very well-known; I learned about it when I was a student, in my Computer Vision class. Unfortunately the lecture notes are not in English. But after searching around a bit, I found it's from this paper:

Silvano Di Zenzo, "A note on the gradient of a multi-image", 1986

You can download the PDF easily. What I did is all in that paper, but there are many ways of calculating the maximum eigenvalue (gradient magnitude). The author used those sin/cos formulas, but I calculated it directly by applying the eigenvalue formulas for 2x2 matrices, which you can find in Section 1.2 of The Matrix Cookbook (available online).

16 Sep 2011 Fast edges of a color image (actual color, not converting to grayscale) Edges of a color image by the max gradient method. Author: Joao Henriques Joao Henriques

I'm not sure the derivative estimation can be improved much. I may be ignoring some more recent work, but my impression is that that line of research was dropped a while ago, and most people nowadays use simple estimates of the derivatives. The papers I read showed improvements on synthetic images but no real-life data. (Correct me if I'm wrong please!)

The reason is that obtaining "good" edges depends on your problem, and usually it doesn't make sense to optimize it at such a low-level. There's always a risk of overfitting your data. I come from a pattern recognition background, so usually we try to get good low-level features but sort them out at a higher level (eg., fitting line segments, classifying windows with SVMs).

This method yields better results when grayscale data doesn't show edges but color data does. Sobel filters are the same as simple differences (ie, xfilter=[-1 1]) with a small amount of smoothing. So I'm not sure you can squeeze much more performance out of edge detection code, even with those methods.

05 Apr 2011 FIGHT TO THE DEATH AGAINST A GIANT CHICKEN An epic finalfantasy-style fight against an AI controled chicken with a dynamic interface :P Author: Emile B. Joao Henriques

Epic fight! But why is Cloud fighting a Chocobo? I thought they were friends :(

05 Mar 2011 xml2struct Convert an xml file into a MATLAB structure for easy access to the data. Author: Wouter Falkena Joao Henriques

Simple and works pretty well! The structures are a bit verbose but they're supposed to be parsed by my program anyway; any attempts to collapse some of the nested structures would only slow down the code (some similar submissions do this but are much slower). Thanks!

05 Mar 2011 xml_io_tools Read XML files into MATLAB struct and writes MATLAB data types to XML Author: Jaroslaw Tuszynski Joao Henriques

Simple and works pretty well! The structures are a bit verbose but they're supposed to be parsed by my program anyway; any attempts to collapse some of the nested structures would only slow down the code (some similar submissions do this but are much slower). Thanks!

21 Dec 2010 DOTNOT - Dot Notation Implements a replacement interface to GET/SET for graphic/gui options. Author: Peter Rydesäter Joao Henriques

(Ok the first comment I was referring to was deleted, probably by a MW moderator. I'm posting this so no one thinks I'm talking about Joerg's comment, which is the first one now.)

20 Dec 2010 DOTNOT - Dot Notation Implements a replacement interface to GET/SET for graphic/gui options. Author: Peter Rydesäter Joao Henriques

The first comment/rating looks like it was made by a cat stepping on a keyboard! ;) Bad kitty...

This is an excellent idea and I wish MW would take a look at it, it makes so much sense. It saddens me that it's not being actively maintained.

Anyway, the code could use some more comments, and I'm sure there's a smart way of using FEVAL and friends to replace many of the hardcoded function calls in SUBSREF. Still, this small piece of code already makes GUI code much more readable. I hope the author or someone else picks this up and it regains some interest by the community!

14 Dec 2010 Super Mario Brothers Theme - Huggins Illusion Huggins pitch via all-pass filtering played to the tune of Mario bro's Author: Nick Clark Joao Henriques

Intriguing stuff; it's impossible to hear the "tune" when listening to it only with the left or right side of the headphones. I still can't believe it's an illusion, it sounds so real! As someone who has always liked optical illusions I can now add an audio illusion to the mix :) Thanks also for the PDF and references to more reading material.

18 Nov 2010 On-The-Fly Definition of Custom Matrix Objects Class of matrix-like objects with on-the-fly definable methods. Author: Matt J Joao Henriques

Yes, the main application IMO is simplifying syntax, creating a sort of mini-language. Another good use would be creating a matrix that self-validates on any operations, for instance a "positive-definite matrix" that raises an error if this condition is not verified. This kind of use is what motivated my question earlier :)

16 Nov 2010 maxflow A wrapper library for Boykov and Kolmogorov max-flow/min-cut implementation Author: Miki Rubinstein Joao Henriques

Courosh, just set T(i,j)=0 where you *don't* want a seed (capacity 0).

15 Nov 2010 On-The-Fly Definition of Custom Matrix Objects Class of matrix-like objects with on-the-fly definable methods. Author: Matt J Joao Henriques

Nice and useful! One question, do you think a native code implementation would minimize the overhead significantly? Or the bottleneck here is the call to an anonymous function?

16 Oct 2010 cyclebasis Find a basis for the cycle subspace of a graph/network. Author: Ben Petschel Joao Henriques

Works as advertised! Good work ;)

06 Jul 2010 GUI Layout Toolbox Layout management objects for MATLAB GUIs Author: Ben Tordoff Joao Henriques

This seems pretty neat, but I can't get it to work with R2008b. Isn't backward compatibility a concern? At least to some degree -- 2008b is not that old (we're in 2010), and I like it as a stable platform; I can't change every year :)

More specifically, some examples use the brand-new "~ for unused parameters" functionality (which is fixed easily), and calls to the "feature" function result in the error "An unknown feature was specified".
>> which feature
built-in (undocumented)

All in all, this seems like a good system and I'd love to try it, but it only seems directed at the newest ML release (which seems odd, considering it includes a "doc" replacement that intends to fix a R2007 problem).

23 Jun 2010 maxflow A wrapper library for Boykov and Kolmogorov max-flow/min-cut implementation Author: Miki Rubinstein Joao Henriques

Nice! A few small issues:
1) The help mentions a link for creating sparse matrices efficiently, but I can't find anywhere!
2) I don't get why you release the DLL after every call, which seems wasteful when using repeatedly (isn't it ok to just call the mex file directly?).
3) The 2nd example could be more interesting -- the cut is not exactly what you'd expect, until you find out that the flow is from the left-most pixels to the right-most.

Other than that, excellent work, and thanks for sharing this!

23 Jun 2010 KMeans Segmentation - MEX Given N data elements of R dimensions (N x R matrix), it segregates the n elements into k clusters Author: Ahmad Joao Henriques

Looking good! The utilities file was a nice surprise. :)

23 Jun 2010 KMeans Segmentation - MEX Given N data elements of R dimensions (N x R matrix), it segregates the n elements into k clusters Author: Ahmad Joao Henriques

09 Jun 2010 SumProductLab for Factor Graphs This is an platform for experiments with factor graphs. Author: Henry Leung Joao Henriques

31 May 2010 Region Adjacency Graph (RAG) Computes the graph of adjacent regions in a labeled image Author: David Legland Joao Henriques

30 Apr 2010 prettyplot Prettier line plots with markers. Author: Cris Luengo Joao Henriques

16 Apr 2010 farg: a pedestrian M-file parser showing all used functions' syntax parses an M-file searching for functions and prints their exact, literal syntax Author: us Joao Henriques

06 Apr 2010 Learning the Extended Kalman Filter An implementation of Extended Kalman Filter for nonlinear state estimation. Author: Yi Cao Joao Henriques

06 Apr 2010 KalmanFilter Simple Kalman Filter implementation Author: Kedar Patwardhan Joao Henriques

06 Apr 2010 Mouse-friendly FIGURE Same as FIGURE, but zooming/panning is done more conveniently with scroll wheel/clicks. Author: Rody Oldenhuis Joao Henriques

Very intuitive controls to explore 2D data :)

05 Apr 2010 Data Structure: A Cell Array List Container Provides a useful 1D container for storing an ordered heterogeneous set of elements Author: Bobby Nedelkovski Joao Henriques

Bug found: if you remove all elements, capacity will be 0. It will then, when adding a new element, enter an infinite loop (!) trying to multiply the capacity by 2 until it reaches the desired number of elements, which will never happen. Since the simple behavior of "adding some elements, removing them, adding some more" was never tested, I'm starting to get the impression that this class never got much use by the author... =|

01 Apr 2010 Data Structure: A Cell Array List Container Provides a useful 1D container for storing an ordered heterogeneous set of elements Author: Bobby Nedelkovski Joao Henriques

Ah, one important feature is missing: "set". You can "get" elements, but not write to them! Removing and then adding incurs unnecessary overhead. It would also be nice if you overloaded standard methods such as "subsref" and "subsasgn" so we can use index notation instead of get/set methods.

31 Mar 2010 Data Structure: A Cell Array List Container Provides a useful 1D container for storing an ordered heterogeneous set of elements Author: Bobby Nedelkovski Joao Henriques

Pretty cool! Now if there was a realization of the abstract class as a C-implemented linked list...

23 Mar 2010 Drawing Color Histograms and Color Clouds Matlab code to plot color histograms and color clouds Author: Chaitanya Sai Gaddam Joao Henriques

03 Feb 2010 Pairwise Distance Matrix Compute a matrix of square Euclidean or Mahalanobis distances between points sets(fully optimized!). Author: Mo Chen Joao Henriques

Meh, this code is fine. Works as advertised. I don't think it is correct to pick on someone just because of some reasonable optimizations. You could've saved all the talk, point out that this returns squared distances and thus should be renamed, and the author would surely comply with your request.

12 May 2009 SimMechanics™ rover This SimMechanics™ model implements a 4 wheels rover with suspension and a robotic arm. Author: Guy Rouleau Joao Henriques

21 Apr 2009 TIMEIT Benchmarking Function TIMEIT.M measures the time required to call a user-specified function Author: Steve Eddins Joao Henriques

This is extremely useful, but since it requires a function definition, you must either use lambdas, which don't allow procedural code (ie, a list of statements), define a local function, which means you have to turn your script into a function file (sometimes not desirable when dealing with workspace variables), or create a new file (lots of throwaway files with simple routines).

I wonder if it would be possible to add the following functionality (either in the same function or through a different one) :

while timeit %returns true when a new measurement is needed
... my procedural code ...
... multiple lines, will run as many times as timeit() sees fit ...
end
result = timeit; %next call: return result. reset state.

As you can see, this sort of usage would be tremendously useful to just profile a piece of code with no extra details -- just wrap it in a loop. Of course, it's only fair if you conclude it's not worth the additional effort :)

Contact us