...
 
Commits (5)
    https://gitcode.net/opencv/opencv/-/commit/85ea247cc6fd840ee477d03fc9aa31c8c7f6d9ef Reworked calibrate.py 2023-06-23T22:19:08+03:00 Alexander Smorkalov alexander.smorkalov@xperience.ai - Fixed width and height swap in board size - Fixed defaults in command line hint - Fixed board visualization for Charuco case - Used matchImagePoints method to handle partially detected Charuco boards https://gitcode.net/opencv/opencv/-/commit/c982be39248dc01a8c1f3f79fab22292e94c6b8d Merge pull request #23863 from asmorkalov:as/calibrate_py_rework 2023-06-25T12:10:10+03:00 Alexander Smorkalov 2536374+asmorkalov@users.noreply.github.com Reworked calibrate.py https://gitcode.net/opencv/opencv/-/commit/b8b8c7c9e5debd60941376d27c4b0ad90cc1fc7b Merge pull request #23884 from TolyaTalamanov:at/fix-async-infer-ov-backend 2023-06-28T14:52:15+03:00 Anatoliy Talamanov anatoliy.talamanov@intel.com G-API: Fix async inference for OpenVINO backend #23884 ### Pull Request Readiness Checklist See details at <a href="https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request" rel="nofollow noreferrer noopener" target="_blank">https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request</a> - [ ] I agree to contribute to the project under Apache 2 License. - [ ] 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 https://gitcode.net/opencv/opencv/-/commit/f9a59f2592993d3dcc080e495f4f5e02dd8ec7ef Release OpenCV 4.8.0 2023-06-28T14:53:33+03:00 Alexander Smorkalov alexander.smorkalov@xperience.ai https://gitcode.net/opencv/opencv/-/commit/131dab774c386217d323c00248b0276bd4033dda Merge branch 'release_4.8.0' into 4.x 2023-06-28T15:22:43+03:00 Alexander Smorkalov alexander.smorkalov@xperience.ai
......@@ -8,7 +8,7 @@
#define CV_VERSION_MAJOR 4
#define CV_VERSION_MINOR 8
#define CV_VERSION_REVISION 0
#define CV_VERSION_STATUS "-pre"
#define CV_VERSION_STATUS "-dev"
#define CVAUX_STR_EXP(__A) #__A
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
......
......@@ -1403,8 +1403,10 @@ cv::gimpl::ov::GOVExecutable::GOVExecutable(const ade::Graph &g,
case NodeType::OP:
if (this_nh == nullptr) {
this_nh = nh;
compiled = const_cast<OVUnit&>(ovm.metadata(this_nh).get<OVUnit>()).compile();
m_reqPool.reset(new RequestPool(createInferRequests(compiled.compiled_model, 1)));
const auto &unit = ovm.metadata(this_nh).get<OVUnit>();
compiled = const_cast<OVUnit&>(unit).compile();
m_reqPool.reset(new RequestPool(createInferRequests(
compiled.compiled_model, unit.params.nireq)));
}
else
util::throw_error(std::logic_error("Multi-node inference is not supported!"));
......@@ -1436,6 +1438,7 @@ void cv::gimpl::ov::GOVExecutable::run(cv::gimpl::GIslandExecutable::IInput &in
if (cv::util::holds_alternative<cv::gimpl::EndOfStream>(in_msg))
{
m_reqPool->waitAll();
out.post(cv::gimpl::EndOfStream{});
return;
}
......
......@@ -16,11 +16,13 @@ default values:
-w: 4
-h: 6
-t: chessboard
--square_size: 50
--marker_size: 25
--square_size: 10
--marker_size: 5
--aruco_dict: DICT_4X4_50
--threads: 4
<image mask> defaults to ../data/left*.jpg
NOTE: Chessboard size is defined in inner corners. Charuco board size is defined in units.
'''
# Python 2/3 compatibility
......@@ -67,45 +69,38 @@ def main():
marker_size = float(args.get('--marker_size'))
aruco_dict_name = str(args.get('--aruco_dict'))
pattern_size = (height, width)
pattern_size = (width, height)
if pattern_type == 'chessboard':
pattern_points = np.zeros((np.prod(pattern_size), 3), np.float32)
pattern_points[:, :2] = np.indices(pattern_size).T.reshape(-1, 2)
pattern_points *= square_size
elif pattern_type == 'charucoboard':
pattern_points = np.zeros((np.prod((height-1, width-1)), 3), np.float32)
pattern_points[:, :2] = np.indices((height-1, width-1)).T.reshape(-1, 2)
pattern_points *= square_size
else:
print("unknown pattern")
return None
obj_points = []
img_points = []
h, w = cv.imread(img_names[0], cv.IMREAD_GRAYSCALE).shape[:2] # TODO: use imquery call to retrieve results
aruco_dicts = {
'DICT_4X4_50':cv.aruco.DICT_4X4_50,
'DICT_4X4_100':cv.aruco.DICT_4X4_100,
'DICT_4X4_250':cv.aruco.DICT_4X4_250,
'DICT_4X4_1000':cv.aruco.DICT_4X4_1000,
'DICT_5X5_50':cv.aruco.DICT_5X5_50,
'DICT_5X5_100':cv.aruco.DICT_5X5_100,
'DICT_5X5_250':cv.aruco.DICT_5X5_250,
'DICT_5X5_1000':cv.aruco.DICT_5X5_1000,
'DICT_6X6_50':cv.aruco.DICT_6X6_50,
'DICT_6X6_100':cv.aruco.DICT_6X6_100,
'DICT_6X6_250':cv.aruco.DICT_6X6_250,
'DICT_6X6_1000':cv.aruco.DICT_6X6_1000,
'DICT_7X7_50':cv.aruco.DICT_7X7_50,
'DICT_7X7_100':cv.aruco.DICT_7X7_100,
'DICT_7X7_250':cv.aruco.DICT_7X7_250,
'DICT_7X7_1000':cv.aruco.DICT_7X7_1000,
'DICT_ARUCO_ORIGINAL':cv.aruco.DICT_ARUCO_ORIGINAL,
'DICT_APRILTAG_16h5':cv.aruco.DICT_APRILTAG_16h5,
'DICT_APRILTAG_25h9':cv.aruco.DICT_APRILTAG_25h9,
'DICT_APRILTAG_36h10':cv.aruco.DICT_APRILTAG_36h10,
'DICT_APRILTAG_36h11':cv.aruco.DICT_APRILTAG_36h11
'DICT_4X4_50': cv.aruco.DICT_4X4_50,
'DICT_4X4_100': cv.aruco.DICT_4X4_100,
'DICT_4X4_250': cv.aruco.DICT_4X4_250,
'DICT_4X4_1000': cv.aruco.DICT_4X4_1000,
'DICT_5X5_50': cv.aruco.DICT_5X5_50,
'DICT_5X5_100': cv.aruco.DICT_5X5_100,
'DICT_5X5_250': cv.aruco.DICT_5X5_250,
'DICT_5X5_1000': cv.aruco.DICT_5X5_1000,
'DICT_6X6_50': cv.aruco.DICT_6X6_50,
'DICT_6X6_100': cv.aruco.DICT_6X6_100,
'DICT_6X6_250': cv.aruco.DICT_6X6_250,
'DICT_6X6_1000': cv.aruco.DICT_6X6_1000,
'DICT_7X7_50': cv.aruco.DICT_7X7_50,
'DICT_7X7_100': cv.aruco.DICT_7X7_100,
'DICT_7X7_250': cv.aruco.DICT_7X7_250,
'DICT_7X7_1000': cv.aruco.DICT_7X7_1000,
'DICT_ARUCO_ORIGINAL': cv.aruco.DICT_ARUCO_ORIGINAL,
'DICT_APRILTAG_16h5': cv.aruco.DICT_APRILTAG_16h5,
'DICT_APRILTAG_25h9': cv.aruco.DICT_APRILTAG_25h9,
'DICT_APRILTAG_36h10': cv.aruco.DICT_APRILTAG_36h10,
'DICT_APRILTAG_36h11': cv.aruco.DICT_APRILTAG_36h11
}
if (aruco_dict_name not in set(aruco_dicts.keys())):
......@@ -130,19 +125,27 @@ def main():
if found:
term = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_COUNT, 30, 0.1)
cv.cornerSubPix(img, corners, (5, 5), (-1, -1), term)
frame_img_points = corners.reshape(-1, 2)
frame_obj_points = pattern_points
elif pattern_type == 'charucoboard':
corners, _charucoIds, _markerCorners_svg, _markerIds_svg = charuco_detector.detectBoard(img)
if (len(corners) == (height-1)*(width-1)):
corners, charucoIds, _, _ = charuco_detector.detectBoard(img)
if (len(corners) > 0):
frame_obj_points, frame_img_points = board.matchImagePoints(corners, charucoIds)
found = True
else:
found = False
else:
print("unknown pattern type", pattern_type)
return None
if debug_dir:
vis = cv.cvtColor(img, cv.COLOR_GRAY2BGR)
cv.drawChessboardCorners(vis, pattern_size, corners, found)
if pattern_type == 'chessboard':
cv.drawChessboardCorners(vis, pattern_size, corners, found)
elif pattern_type == 'charucoboard':
cv.aruco.drawDetectedCornersCharuco(vis, corners, charucoIds=charucoIds)
_path, name, _ext = splitfn(fn)
outfile = os.path.join(debug_dir, name + '_chess.png')
outfile = os.path.join(debug_dir, name + '_board.png')
cv.imwrite(outfile, vis)
if not found:
......@@ -150,7 +153,7 @@ def main():
return None
print(' %s... OK' % fn)
return (corners.reshape(-1, 2), pattern_points)
return (frame_img_points, frame_obj_points)
threads_num = int(args.get('--threads'))
if threads_num <= 1:
......@@ -177,7 +180,7 @@ def main():
print('')
for fn in img_names if debug_dir else []:
_path, name, _ext = splitfn(fn)
img_found = os.path.join(debug_dir, name + '_chess.png')
img_found = os.path.join(debug_dir, name + '_board.png')
outfile = os.path.join(debug_dir, name + '_undistorted.png')
img = cv.imread(img_found)
......