5

I'm looking for a possibility to convert raster images to vector data using OpenCV. There I found a function cv::findContours() which seems to be a bit primitive (more probably I did not understand it fully):

It seems to use b/w images only (no greyscale and no coloured images) and does not seem to accept any filtering/error suppresion parameters that could be helpful in noisy images, to avoid very short vector lines or to avoid uneven polylines where one single, straight line would be the better result.

So my question: is there a OpenCV possibility to vectorise coloured raster images where the colour-information is assigned to the resulting polylinbes afterwards? And how can I apply noise reduction and error suppression to such a algorithm?

Thanks!

ArtemStorozhuk
  • 8,715
  • 4
  • 35
  • 53
Elmi
  • 5,899
  • 15
  • 72
  • 143
  • Can you show us the input image you want to vectorize? – ArtemStorozhuk Oct 15 '12 at 12:52
  • There is not ONE input image that has to be used and all others are similar. But to get an rough idea about what I mean: imagine the St*rb*cks-logo, it consists of two colours (plus one for white background), so the resulting vector data should be sorted according to colours. – Elmi Oct 16 '12 at 06:56

1 Answers1

5

If you want to raster image by color than I recommend you to clusterize image on some group of colors (or quantalize it) and after this extract contours of each color and convert to needed format. There are no ready vectorizing methods in OpenCV.

ArtemStorozhuk
  • 8,715
  • 4
  • 35
  • 53
  • That seems to be an chicken-and-egg problem: which colours are relevant for vectorisation can be evaluated only by the vectorisation process itself (an image may contains some colours that fade only from colour of one relevant edge to an other and therefore would not result in relevant vector lines). anyway, thanks for your hints. – Elmi Oct 17 '12 at 09:44