0
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

The cheapest representation is clearly if you convert the image into text, with attributes for the font style. You only need one byte per character (plus a couple of bits for the font style), which is always going to be cheaper than having to store coordinates for line segments etc. That's the power of using ancillary information: if you know that an image consists of text, storing the text is far cheaper than storing a representation of the text.

$\endgroup$
1
  • $\begingroup$ this is true if the intepreter (that read the code and rasterize it, back) can handle text, but it can only handle rectangle in my scenario (as stated in the question). $\endgroup$ – Skary Dec 29 '15 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.