mirror of
https://github.com/zebrajr/opencv.git
synced 2025-12-06 00:19:46 +01:00
Merge pull request #27906 from asmorkalov:as/cairosvg
Use cairosvg for pattern rendering to get rid of double resize. #27906 Depends on https://github.com/opencv/ci-gha-workflow/pull/269 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
parent
d0d9bd20ed
commit
703f0bb0f2
|
|
@ -11,10 +11,9 @@ class aruco_objdetect_test(NewOpenCVTests):
|
|||
|
||||
def test_aruco_dicts(self):
|
||||
try:
|
||||
from svglib.svglib import svg2rlg
|
||||
from reportlab.graphics import renderPM
|
||||
import cairosvg
|
||||
except:
|
||||
raise self.skipTest("libraies svglib and reportlab not found")
|
||||
raise self.skipTest("cairosvg library was not found")
|
||||
else:
|
||||
cols = 3
|
||||
rows = 5
|
||||
|
|
@ -49,8 +48,7 @@ class aruco_objdetect_test(NewOpenCVTests):
|
|||
os.path.join(basedir, aruco_type_str[aruco_type_i]+'.json.gz'), 0)
|
||||
pm.make_charuco_board()
|
||||
pm.save()
|
||||
drawing = svg2rlg(filesvg)
|
||||
renderPM.drawToFile(drawing, filepng, fmt='PNG', dpi=72)
|
||||
cairosvg.svg2png(url=filesvg, write_to=filepng, background_color="white")
|
||||
from_svg_img = cv.imread(filepng)
|
||||
_charucoCorners, _charuco_ids_svg, marker_corners_svg, marker_ids_svg = charuco_detector.detectBoard(from_svg_img)
|
||||
_charucoCorners, _charuco_ids_cv, marker_corners_cv, marker_ids_cv = charuco_detector.detectBoard(from_cv_img)
|
||||
|
|
@ -72,10 +70,9 @@ class aruco_objdetect_test(NewOpenCVTests):
|
|||
|
||||
def test_aruco_marker_sizes(self):
|
||||
try:
|
||||
from svglib.svglib import svg2rlg
|
||||
from reportlab.graphics import renderPM
|
||||
import cairosvg
|
||||
except:
|
||||
raise self.skipTest("libraies svglib and reportlab not found")
|
||||
raise self.skipTest("cairosvg library was not found")
|
||||
else:
|
||||
cols = 3
|
||||
rows = 5
|
||||
|
|
@ -106,8 +103,7 @@ class aruco_objdetect_test(NewOpenCVTests):
|
|||
board_height, "charuco_checkboard", marker_size, os.path.join(basedir, aruco_type_str+'.json.gz'), 0)
|
||||
pm.make_charuco_board()
|
||||
pm.save()
|
||||
drawing = svg2rlg(filesvg)
|
||||
renderPM.drawToFile(drawing, filepng, fmt='PNG', dpi=72)
|
||||
cairosvg.svg2png(url=filesvg, write_to=filepng, background_color="white")
|
||||
from_svg_img = cv.imread(filepng)
|
||||
|
||||
#test
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user