Skip to content

(4.x) Merge 3.4 #3365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/xfeatures2d/include/opencv2/xfeatures2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class CV_EXPORTS_W MSDDetector : public Feature2D {

public:

static Ptr<MSDDetector> create(int m_patch_radius = 3, int m_search_area_radius = 5,
CV_WRAP static Ptr<MSDDetector> create(int m_patch_radius = 3, int m_search_area_radius = 5,
int m_nms_radius = 5, int m_nms_scale_radius = 0, float m_th_saliency = 250.0f, int m_kNN = 4,
float m_scale_factor = 1.25f, int m_n_scales = -1, bool m_compute_orientation = false);
};
Expand Down
24 changes: 24 additions & 0 deletions modules/xfeatures2d/misc/python/test/test_descriptors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env python

# Python 2/3 compatibility
from __future__ import print_function

import os
import numpy as np
import cv2 as cv

from tests_common import NewOpenCVTests

class MSDDetector_test(NewOpenCVTests):

def test_create(self):

msd = cv.xfeatures2d.MSDDetector_create()
self.assertFalse(msd is None)

img1 = np.zeros((100, 100, 3), dtype=np.uint8)
kp1_ = msd.detect(img1, None)


if __name__ == '__main__':
NewOpenCVTests.bootstrap()
9 changes: 6 additions & 3 deletions modules/ximgproc/samples/edge_drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def main():
# Detect edges
# you should call this before detectLines() and detectEllipses()
ed.detectEdges(gray)

segments = ed.getSegments()
lines = ed.detectLines()
ellipses = ed.detectEllipses()
Expand All @@ -67,14 +68,16 @@ def main():

#Draw detected circles and ellipses
if ellipses is not None: # Check if circles and ellipses have been found and only then iterate over these and add them to the image
ellipses = np.uint16(np.around(ellipses))
for i in range(len(ellipses)):
center = (int(ellipses[i][0][0]), int(ellipses[i][0][1]))
axes = (int(ellipses[i][0][2])+int(ellipses[i][0][3]),int(ellipses[i][0][2])+int(ellipses[i][0][4]))
angle = ellipses[i][0][5]
color = (0, 0, 255)
if ellipses[i][0][2] == 0:
color = (0, 255, 0)
cv.ellipse(esrc, (ellipses[i][0][0], ellipses[i][0][1]), (ellipses[i][0][2]+ellipses[i][0][3],ellipses[i][0][2]+ellipses[i][0][4]),ellipses[i][0][5],0, 360, color, 2, cv.LINE_AA)
cv.ellipse(esrc, center, axes, angle,0, 360, color, 2, cv.LINE_AA)

cv.imshow("detected ellipses", esrc)
cv.imshow("detected circles and ellipses", esrc)
cv.waitKey(0)
print('Done')

Expand Down