-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: master
Are you sure you want to change the base?
Conversation
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
Interface of the function should be something like: input image Plotting might be in some sort of tools which is used find_keypoints function |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
src/pygats/recog.py
Outdated
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)) |
There was a problem hiding this comment.
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
"""
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
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