As stated in the title I have a raster image (black or white) with no complex or fuzzied components (only horizontal or vertical text, italic or bold are allowed).I need to express that raster image in as cheap a way as possibile using vertor representation (I only have one primitive that can draw a rectangle).My first naive approach is to scan the image and use a line for each segment that I find in my scanning proccess.If I do that for both the horizontal and vertical direction I can choose the cheapest representation.Sure that is not the best way, a bold 'T' letter results in a lot of lines with my approach, but it can be decomposed in two rectangles (best solution).So what I am asking is, which is the best approach to deal with my particular vectorization problem?
Vectorization Algorithm using only rectangle
vectorization