Introduction - If you have any usage issues, please Google them yourself
Split and merge Algorithm for Image Processing . It uses a quad tree as data structure, which is created at running time using breath first method, and a stopping criterion . The stoping criterion method can be changed , i just used to the difference of means of the regions which should be merged , compared with some threshold.