Finding a line in an image file

若如初见. 提交于 2019-12-11 23:02:28

问题


I am trying to crop out the printer marks that are at the edges of a PDF.

The path i want to take to solve this problem is as follows: Convert PDF into a bitmap and then traverse the bitmap and try to find the lines, then once the lines are found, find the coordinates of the edges of these lines, set the cropping coordinates to the coordinates just found.

However the problems that pop up in my mind with this approach is how to know when the lines end and the actual page starts. How to differentiate lines from letters.

How do I overcome these hurdles, or is there a better way to crop out the printer marks from a PDF?


回答1:


There is no general answer that works for ALL PDF files, however there are a few useful strategies that are implemented by existing solutions for graphics arts such as callas pdfToolbox (watch it, I'm associated with this product) or PitStop. The strategies center around a number of facts:

  • trim and bleed marks are usually simple lines (though thin rectangles are sometimes used as well). They are short and straight (horizontal or vertical).

  • These marks are usually drawn in specific colours. Either CMYK with the color set to 100%, 100%, 100%, 100% or - more commonly - a special spot color called "All". You're almost guaranteed of this because these marks need to show up on every printed separation (sorry for the technical printing terms if you're not familiar with them).

  • These marks normally are mirrored symmetrically. You're not looking for a single mark - you're looking for a set of them and this typically helps with recognition a lot. Watch out however that you're not confused by bad applications which don't place marks with absolute accuracy.

Lastly but perhaps not important in your application, different regions can actually work with different types of marks. Japanese trim and bleed marks for example look completely different than European or US marks.



来源:https://stackoverflow.com/questions/18216435/finding-a-line-in-an-image-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!