Separate sub-figures!
Conceptually, it's straightforward. Let's consider a more general case, involving a grid:



First run ridge detection, box blurring, then line detection:



The purpose of this preprocessing is to make line detection more successful. Finally, partition the image vertically (only first partition shown): 



then horizontally:



In Mathematica it can be done as follows:

img = Import["http://englishwalle.files.wordpress.com/2013/08/9-image-grid-no-logo1.jpg"]
{W, H} = ImageDimensions[img]
edges = ImageConvolve[Binarize@RidgeFilter[img, 0.001], BoxMatrix[2]]
lines = ImageLines[edges, 2, 0.1]
hlines = Select[lines, Norm[#[[1]] - #[[2]]] == W &amp;]
offsets = Flatten@{0, #[[1 , 2]] &amp; /@ hlines, ImageDimensions[img][[2]]}
hparts = Partition[H - # &amp; /@ offsets // Sort, 2, 1]
vsections = ImageTake[img, #] &amp; /@ hparts

(* Part 2 *)
hmask = ImageAdjust[ImageAdjust@RidgeFilter[Blur[#, {100, 0}], 5], 1] &amp; /@ vsections
lines = ImageLines[#, 0.075, 0.25] &amp; /@ hmask
vlines = #[[1, 1]] &amp; /@ # &amp; /@ lines
vlinesUnique = W*DeleteDuplicates@MeanShift[#, 1] &amp; /@ vlines/W
vparts = Partition[Flatten[{0, Sort@#, W}], 2, 1] &amp; /@ vlines_uniq
hsections = Outer[ImageTake, {#[[1]]}, {{0, W}}, #[[2]], 1] &amp; /@ Transpose[{vsections, vparts}]


I leave it to you to translate this into your language of choice.

edit: With your image, I had better results with a derivative filter than a ridge filter (though that worked too, but the seam was not exactly at the right place). This is what directional blurring and derivative filtering (hmask = DerivativeFilter[Blur[img, {100, 0}], {0, 1}]) looks like on your image:





Line detection works trivially after this.