Skip to content

[G-API]: fitLine() Standard Kernel Implementation#18790

Merged
alalek merged 6 commits intoopencv:masterfrom
OrestChura:oc/fitLine
Nov 17, 2020
Merged

[G-API]: fitLine() Standard Kernel Implementation#18790
alalek merged 6 commits intoopencv:masterfrom
OrestChura:oc/fitLine

Conversation

@OrestChura
Copy link
Copy Markdown
Contributor

These changes:

  • Add fitLine() standard kernel
    • provide API and documentation:
      • to support all the original OpenCV functionality, provide two different API (for 2D and 3D points) with several overloads for both (for input cv::GMat, cv::GArray<Point{2,3}i>, cv::GArray<Point{2,3}f>, cv::GArray<Point{2,3}d>)
    • support OCV backend
    • provide accuracy tests
  • comparison function for cv::Vec<T, n> provided

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • 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 other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • 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
force_builders=Custom,Custom Win,Custom Mac
build_gapi_standalone:Linux x64=ade-0.1.1f
build_gapi_standalone:Win64=ade-0.1.1f
build_gapi_standalone:Mac=ade-0.1.1f
build_gapi_standalone:Linux x64 Debug=ade-0.1.1f

build_image:Custom=centos:7
buildworker:Custom=linux-1
build_gapi_standalone:Custom=ade-0.1.1f

Xbuild_image:Custom=ubuntu-openvino-2020.3.0:16.04
Xbuild_image:Custom Win=openvino-2020.3.0
Xbuild_image:Custom Mac=openvino-2020.3.0

test_modules:Custom=gapi
test_modules:Custom Win=gapi
test_modules:Custom Mac=gapi

buildworker:Custom=linux-1
# disabled due high memory usage: test_opencl:Custom=ON
test_opencl:Custom=OFF
test_bigdata:Custom=1
test_filter:Custom=*

 - initialization for vectors of cv::Point and Mats via vectors added
 - comparison functions for Vec<T, n> added:
   - straight average difference comparison
   - comparison by equasion for 2d line
 - stream overload for cv::DistanceTypes added
vec_.clear();
vec_.reserve(sz_in);

for (int i = 0; i < sz_in; i++)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a warning here:

gapi_tests_common.hpp(339): warning C4702: unreachable code

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try to print the values here (sz_in, vec_). There might me an uninitialized value somewhere

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alalek please, could you help with these two problems?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it is a test code (not a public header), so you can eliminate this warning through #pragma for MSVS 2015 (use _MSC_VER < 1910/*MSVS 2017*/)

{
Pt<T> pt;
initPointRandU(rng, pt);
vec_.push_back(pt);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here is warning too:

gapi_tests_common.hpp(343): warning C4702: unreachable code

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mb emplace_back, or wrapping (Pt{pt}) might help

double _tol;
};

// class AbsToleranceLine2D : public WrappableVec<AbsToleranceLine2D, float, 4>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Copy link
Copy Markdown
Contributor

@smirnov-alexey smirnov-alexey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great, thanks for your effort!

Try to fix warning
Copy link
Copy Markdown
Contributor

@smirnov-alexey smirnov-alexey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks

Copy link
Copy Markdown
Contributor

@mpashchenkov mpashchenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alalek alalek merged commit 2c6a2f0 into opencv:master Nov 17, 2020
@alalek alalek mentioned this pull request Nov 27, 2020
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
[G-API]: fitLine() Standard Kernel Implementation

* fitLine API (Mat, 32S, 32F) (2D, 3D)

* Complete fitLine kernel & accuracy tests
 - initialization for vectors of cv::Point and Mats via vectors added
 - comparison functions for Vec<T, n> added:
   - straight average difference comparison
   - comparison by equasion for 2d line
 - stream overload for cv::DistanceTypes added

* Fix precommit warnings

* Fix docs

* Address comments
Try to fix warning

* Disable warning in tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants