Skip to content
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

Add a function to search for key points in the image #157

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

Giovaaanniii
Copy link
Contributor

Text recognition will be based on key points. The key points are the interesting areas of the image. Interesting areas are those areas that are heterogeneous. For example, these can be angles, as there is a sharp change in intensity in two different directions

Conclusion: understand in which areas there is a sharp change in color intensity

Иван Горбунов added 8 commits December 20, 2024 00:51
Text recognition will be based on key points. The key points are the interesting areas of the image. Interesting areas are those areas that are heterogeneous. For example, these can be angles, as there is a sharp change in intensity in two different directions

Conclusion: understand in which areas there is a sharp change in color intensity
@vsysoev
Copy link
Contributor

vsysoev commented Dec 20, 2024

Interface of the function should be something like:

input image
returned value keypoints

Plotting might be in some sort of tools which is used find_keypoints function

Copy link
Contributor

@vsysoev vsysoev left a comment

Choose a reason for hiding this comment

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

Function find_keypoints might be exported. Please pay attention to API, documentation and tests

- name: Test with pytest
run: |
DISPLAY=:0 python -m pytest
- uses: actions/checkout@v3
Copy link
Contributor

Choose a reason for hiding this comment

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

Why these tabs in PR?

sift = cv.SIFT_create()
keypoints, _ = sift.detectAndCompute(img, None)
image_with_sift = cv.drawKeypoints(img, keypoints, None)
plt.imshow(cv.cvtColor(image_with_sift, cv.COLOR_BGR2RGB))
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to plot keypoints in recog function. Function in library should not have such side effect.

Please define function something like this: (example) Comment section is very important. This is documentation of the function

def find_cropped_text(ctx, img: Image, txt: SearchedText,
                      skip: Optional[int] = 0, one_word: Optional[bool] = False):
    """
    Find text in image. Several passes are used.
    First time found area with text on image and then
    every area passed through recognition again to improve recognition results

    Args:
        ctx (Context): An object that contains information about the current
                    context.
        img (Image): image to search text in
        txt (SearchedText): text to search
        skip (int, optional): number of occurrences of the text to skip.
        one_word (bool, optional): flag if only one word has been searched.

    Returns:
        (roi, found):
            roi(ROI): region of interest
            found (bool): whether the text is found in the image

    """

Иван Горбунов added 6 commits December 25, 2024 22:16
Create a key point clustering function. This is necessary to find the area of concentration of points using K-means, the algorithm of which is based on the assumption that descriptors that are close to each other in the feature space represent similar key points. Thus, K-means searches for groups of descriptors that have similar meanings.

Conclusion:  group key points based on their descriptors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants