5

Is it possible to convert a PDF file to cv::Mat? I know that PDF file is generally vector of objects, but given a required resolution. Is there any tool that can do such a conversion?

ArtemStorozhuk
  • 8,715
  • 4
  • 35
  • 53
Mercury
  • 1,886
  • 5
  • 25
  • 44
  • 1
    what are you talking about? PDF files are documents~! – thang Jan 21 '13 at 09:54
  • PDF files are anything you would like them to be. They may contain text, images, graphs, links ,etc. I would like to convert the image you see with the viwer into an image. pdf2bmp are common, and I would like an API to convert pdf to cv::Mat. – Mercury Jan 21 '13 at 09:57
  • 1
    why don't you convert to bitmap and load the bitmap to opencv – thang Jan 21 '13 at 10:01
  • Did not find any good c++ API that can convert PDF to image with a given DPI. – Mercury Jan 21 '13 at 10:07
  • What can you say about my answer below? – ArtemStorozhuk Jan 25 '13 at 09:23
  • Had to check it before I answer. Yes The link you supplied did help, just need to combine imagemagick with opencv. thanks :) – Mercury Jan 27 '13 at 21:43

1 Answers1

8

OpenCV doesn't support pdf format at all, so you should convert pdf page to image using another library. Read this discussion: Open source PDF library for C/C++ application?

Also this question is similar to yours: What C++ library can I use to convert a PDF to an image on windows?

Community
  • 1
  • 1
ArtemStorozhuk
  • 8,715
  • 4
  • 35
  • 53