-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[ML Text Recognition] Drawing shapes for slightly rotated images (On captured image) #38
Comments
The mlvision sample doesn't do any slanted highlighting as far as I know. The highlighting logic is here. You may have better luck asking how to draw slanted rectangles on StackOverflow. |
@morganchen12 It does! The following image illustrates that https://imgur.com/vTd8LqE This is using the MlVision example from this repository. At the top right there is a camera icon. The difference is, it does such detection for AVPreviewLayer, so the image is constantly being buffered. But what I would like to do is to only use it with an image I have captured. Additionally, I have already asked my question on StackOverflow as well: https://stackoverflow.com/questions/57197271/draw-appropriate-word-highlight-shapes-for-slightly-rotated-images-with-firebase |
Any update on this, or should I just close the issue? |
Hello!
Background
I am using Firebase text recognition to recognise text in images. However I have the following problem:
As you can see in the image if the target image is slightly rotated then the frames are being overlapped. What I would like to achieve is for the blue rectangles to follow the text rather than having a horizontal shape. Currently I do drawing in the following manner, inside of my
processText(...)
method:The
drawFrame(...)
method does the following:So, once the
line
element is transformed I do the drawing:What did I try?
I tried looking at the
addShape(...)
method in this repository: https://github.com/firebase/quickstart-ios/blob/5b752734233d4be625ece2747385d4974f2fc07f/mlvision/MLVisionExample/UIUtilities.swift#L52I am 100% confident that `addShape(...) is the method to use but I I can see in the example during the live run example it is capable of adjusting the shape of the highlight regardless of how much I rotate the image.
So I tried to do the following:
This is inside my
processResults(...)
method. ThecaptureImageView
is the view in which I put the captured image on and then do processing on it.Similar to the Repository I link above, I copied over the
addShape(..)
into my class. I also coppiedconvertedPoints
andnormalizedPoint
You can see in my
convertedPoints(...)
I am not actually using the normalizedPoint constant (as I am not sure what do there).And this is my
normalizePoint(...)
methodTo Lazy to Read
I would like to adjust the shape of the highlight to adapt to slightly rotated images. Similar to the example
mlvision
application (With live AVFoundation camera run) in this repository.The text was updated successfully, but these errors were encountered: