Identify rectangles of different colors
My suggestion would be in following step. 


If we know that outer shapes (rectangles) are at regular interval - first we should do some sort of segmentation and/or localization. 
Remove portions of background which are of no use and each block is identified and processed separately.
Now if you are expecting lines only horizontally, you can traverse vertically and create scan lines from top-to-bottom. If the region has no dark separations - the scan lines will appear straight albeit with noise. If it crosses the dark line the intensity in the scan line will drop. This will tell the position of dark strip in the block. 
A set of 4 - 5 scan lines (or more) will provide a good co-relating answer.