refactor: use Point struct across the native vision stack#1130
Open
refactor: use Point struct across the native vision stack#1130
Conversation
Member
|
First question, does this handle the scope of this pr: #1126, if so I will close it and you can mark another issue to close ;) EDIT: Ok, I see it's not handling this one, so maybe you can incorporate these changes into your PR? |
Collaborator
Author
|
ok, so I'll cherry-pick commits from #1126 PR and then we'll close it? does it sound fine? @msluszniak |
Member
Yes, probably this would need some tweaking since I hadn't used Point struct. |
Resolves #760. The OCR and VerticalOCR pipelines previously exposed all four rotated-rectangle corners in OCRDetection.bbox. Two points (top-left and bottom-right of the axis-aligned bounding box) are sufficient for downstream rendering and are simpler to consume. Changes: - Types.h: shrink OCRDetection.bbox from std::array<Point,4> to std::array<Point,2> - RecognitionHandler.cpp: compute AABB (min/max x,y) over the four detector corners instead of forwarding them verbatim - VerticalOCR.cpp: same AABB reduction in _processSingleTextBox - OCR.cpp / VerticalOCR.cpp generateFromFrame: re-normalize the two bbox corners after inverseRotatePoints to guarantee bbox[0] <= bbox[1] - JsiConversions.h: serialize 2 points instead of 4 to JavaScript - OCRTest.cpp / VerticalOCRTest.cpp: assert size==2 and that bbox[1] >= bbox[0] - ocr.ts: narrow TypeScript type from Point[] to [Point,Point] and update docs
12 tasks
msluszniak
reviewed
May 8, 2026
Comment on lines
-64
to
74
| interface Point { | ||
| x: number; | ||
| y: number; | ||
| interface Bbox { | ||
| x1: number; | ||
| y1: number; | ||
| x2: number; | ||
| y2: number; | ||
| } | ||
|
|
||
| interface OCRDetection { | ||
| bbox: Point[]; | ||
| bbox: Bbox; | ||
| text: string; | ||
| score: number; | ||
| } | ||
| ``` |
Member
There was a problem hiding this comment.
This is breaking change, right? please change PR title and description
Member
|
Also could you write some basic testing instructions, namely which models are affected, what I specifically need to check? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refactors the native code so it uses unified Point instead of random structures and pair arrays that were scattered all over the codebase.
Introduces a breaking change?
Type of change
Tested on
Testing instructions
Screenshots
Related issues
#760
#1110
Checklist
Additional notes