How can we distinguish raster and vector images?
I have to differentiate raster and vector images without its file extension
I have to differentiate raster and vector images without its file extension
If you're talking about file formats, it's off-topic because it has nothing to do with OpenCV specifically.
Make a list of known raster format headers (eg. PNG files begin with \x89PNG\r\n\x1a\n
) and a list of known vector format headers (eg. SVG is XML with an svg
root element... it may or may not have and <?xml ...>
declaration at the top) and check whether the file matches them.
The imread
function doesn't support loading vector file formats.
If you're talking about distinguishing photographic/scanned/etc. content from losslessly-compressed (eg. PNG) files rendered from vector images (eg. inkscape --export-png=FILENAME.png FILENAME.svg
) then that would be an appropriate OpenCV question.
(And one that would prompt answers I'd be curious about. I'm a novice in this field, so my only intuition would be to explore approaches based on checking how noisy the image is.)
Asked: 2020-02-26 04:21:39 -0600
Seen: 397 times
Last updated: Feb 26 '20
off-topic, imho