Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
原代码中的逻辑是不断寻找两两rect判断他们能不能完成合并,这会导致在处理一些复杂的pdf矢量图的时候耗时极大。我修改成了:1.先排除孤立的长细线(定义为长/宽>8, 且周围有相交bbox数目<2的线) 2.将rect膨胀distance/2(distance是合并判定距离),然后使用shapely.ops内置的更为高效的unary_union进行统一合并。
实验发现代码能显著提升提升效率。在手动检查了部分部分pdf文件的图片提取情况,发现总体提取情况令人满意,和原版代码相比提取质量并无明显下降
改进后时间分布:

原来的时间分布:
