Skip to content

G-API: Introduced a Text Detection sample#18476

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
dmatveev:dm/gapi_text_detection
Oct 22, 2020
Merged

G-API: Introduced a Text Detection sample#18476
opencv-pushbot merged 1 commit intoopencv:masterfrom
dmatveev:dm/gapi_text_detection

Conversation

@dmatveev
Copy link
Copy Markdown
Contributor

This sample models the Text Detection demo from OMZ:
https://github.com/openvinotoolkit/open_model_zoo/tree/2020.4/demos/text_detection_demo

Also: renamed cv::gapi::size() to cv::gapi::streaming::size()

  • 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 reference to 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
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

Xbuild_image:Custom=centos:7
Xbuildworker:Custom=linux-1
build_gapi_standalone:Custom=ade-0.1.1f

build_image:Custom=ubuntu-openvino-2020.4.0:16.04
build_image:Custom Win=openvino-2020.4.0
build_image:Custom Mac=openvino-2020.4.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=*

@dmatveev
Copy link
Copy Markdown
Contributor Author

@mpashchenkov fyi. Please apply for access to the OpenCV team to participate in reviews.

@dmatveev
Copy link
Copy Markdown
Contributor Author

dmatveev commented Oct 1, 2020

Running example:

image

@dmatveev
Copy link
Copy Markdown
Contributor Author

@alalek any chance to get this merged?

@dmatveev
Copy link
Copy Markdown
Contributor Author

Can promote it to the latest master to make sure

auto lower = [](unsigned char c) {
return static_cast<unsigned char>(std::tolower(c));
};
std::transform(ext.begin(), ext.end(), ext.begin(), lower);
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.

cv::toLowerCase() can do that.

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.

Fixed, thanks

#include <opencv2/gapi/infer/ie.hpp>
#include <opencv2/gapi/streaming/cap.hpp>

#include <opencv2/highgui.hpp> // CommandLineParser
Copy link
Copy Markdown
Member

@alalek alalek Oct 14, 2020

Choose a reason for hiding this comment

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

?
CommandLineParser is from core/utility.hpp

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.

Fixed, thanks

int main(int argc, char *argv[])
{
try {
cv::CommandLineParser cmd(argc, argv, keys);
Copy link
Copy Markdown
Member

@alalek alalek Oct 14, 2020

Choose a reason for hiding this comment

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

You can avoid extra indentation from try block in this way:

static void run(int argc, char *argv[])
{
    ... code from try goes here ...
}

int main(int argc, char *argv[])
{
    try
    {
        run(argc, argv);
    }
    catch ...
    {
        ...
    }
    return 0;
}

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.

This try was only needed to debug Windows problems where exception text is not printed in console by default; so I removed it now.

Comment on lines 1735 to 1759
namespace streaming {
/** @brief Gets dimensions from Mat.

@note Function textual ID is "org.opencv.core.size"
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.

Do you really need namespace here?

namespace and ID doesn't look consistent.

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.

I will fix the IDs thanks.

@dmatveev dmatveev force-pushed the dm/gapi_text_detection branch from 03103a4 to 98f6291 Compare October 21, 2020 14:00
This sample models the Text Detection demo from OMZ:
https://github.com/openvinotoolkit/open_model_zoo/tree/2020.4/demos/text_detection_demo

Also: renamed cv::gapi::size() to cv::gapi::streaming::size()
@dmatveev dmatveev force-pushed the dm/gapi_text_detection branch from 98f6291 to 95ff928 Compare October 21, 2020 14:26
Copy link
Copy Markdown
Member

@alalek alalek 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 to me 👍

@opencv-pushbot opencv-pushbot merged commit e1b56e3 into opencv:master Oct 22, 2020
Copy link
Copy Markdown
Contributor

@rgarnov rgarnov 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!

@alalek alalek mentioned this pull request Nov 27, 2020
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