Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@LaurentBerger
Copy link
Contributor

@LaurentBerger LaurentBerger commented Nov 14, 2023

Pull Request Readiness Checklist

resolves #14659

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • 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 another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work blobFromImage and crop #14659
  • 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

@asmorkalov
Copy link
Contributor

@LaurentBerger The PR looks good to me. Could you add several accuracy tests for the new functions. Cases for DNN_PMODE_LETTERBOX, DNN_PMODE_CROP_CENTER and default scale are required.

@asmorkalov asmorkalov added the pr: needs test New functionality requires minimal tests set label Nov 16, 2023
@asmorkalov asmorkalov self-assigned this Nov 16, 2023
@asmorkalov asmorkalov removed the pr: needs test New functionality requires minimal tests set label Nov 20, 2023
@asmorkalov asmorkalov requested a review from dkurt November 28, 2023 12:38
@asmorkalov
Copy link
Contributor

@dkurt please take a look again.

@LaurentBerger
Copy link
Contributor Author

May be a prototype with rect2d is usefull too ?
Rect2d blobRectToImage(Rect r2d, InputArray oriImage, Image2BlobParams param)

@LaurentBerger
Copy link
Contributor Author

@asmorkalov how can I solve conflict?

@asmorkalov
Copy link
Contributor

Let me do it for you.

@LaurentBerger
Copy link
Contributor Author

In doxygen build process
([javadoc] javadoc: error - Error fetching URL: https://docs.oracle.com/en/java/javase/11/docs/api)
network problem?

@LaurentBerger
Copy link
Contributor Author

What's new about this PR?

blobRectsToImageRects rect
o Please enter the commit message for your changes. Lines starting
@dkurt
Copy link
Member

dkurt commented Dec 13, 2023

/Users/opencv-cn/GHA-OCV-1/_work/opencv/opencv/ios/build/build-armv7-iphoneos/lib/Release/opencv2.framework/Headers/Image2BlobParams.h:129:1: error: duplicate declaration of method 'blobRectToImageRect:sizeOri:'

  • (Rect2d*)blobRectToImageRect:(Rect2d*)rBlob sizeOri:(Size2i*)sizeOri NS_SWIFT_NAME(blobRectToImageRect(rBlob:sizeOri:));

@LaurentBerger
Copy link
Contributor Author

  • (Rect2d*)blobRectToImageRect:(Rect2d*)rBlob sizeOri:(Size2i*)sizeOri NS_SWIFT_NAME(blobRectToImageRect(rBlob:sizeOri:));

Is conflict here
CV_WRAP Rect blobRectToImageRect(const Rect &rBlob, const Size &sizeOri);
and
CV_WRAP Rect2d blobRectToImageRect (const Rect2d &rBlob, const Size &sizeOri);
?
If yes what can I do? Must I use CV_EXPORTS_AS?

@dkurt
Copy link
Member

dkurt commented Dec 13, 2023

Not sure, I will take a look closer next day. Commit aba3098 passed without problems.

@LaurentBerger
Copy link
Contributor Author

LaurentBerger commented Dec 13, 2023

Not sure, I will take a look closer next day. Commit aba3098 passed without problems.

I'm not sure that opencv ios was build

* @param rImg result rect in image coordinates.
* @param size spatial size for output image
*/
CV_WRAP_AS(blobRectsToImageRects2d) void blobRectsToImageRects (const std::vector<Rect2d> &rBlob, CV_OUT std::vector<Rect2d>& rImg, const Size& size);
Copy link
Member

Choose a reason for hiding this comment

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

@LaurentBerger , may we ask to remove Rect2d from this PR and if it's a critical feature, discuss separately? In my point of view, users mostly work on Rect (as a ROI or drawable bounding box).

Copy link
Contributor Author

@LaurentBerger LaurentBerger Dec 15, 2023

Choose a reason for hiding this comment

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

In NMSBoxes there is three type Rect, Rect2d and RotatedRect. Now in blobRect(s)ToImageRect(s) there is a scale factor error can be 0 to 2*scaleFactor pixels (2 because there is origin point and dimension)
In python without this function all operation are in float

Copy link
Member

Choose a reason for hiding this comment

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

Because NMSBoxes might be applied as for relative Rect2d (values from 0 to 1) as for absolute pixel coordinates. On blobToImageRect we always return pixel coordinates and subpixel precision is redundant.

Copy link
Contributor Author

@LaurentBerger LaurentBerger Dec 16, 2023

Choose a reason for hiding this comment

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

After this #24173 and #24267 there is now this
I forgot this one #24261
PR for opencv is a waste of time

Copy link
Member

@dkurt dkurt Dec 16, 2023

Choose a reason for hiding this comment

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

Please let me add a commit to this PR to demonstrate my vision of the version with Rect2d.
The proposal is useful but requires partial changes to make all the public API behaviour aligned.

@dkurt dkurt reopened this Dec 19, 2023
Copy link
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍

@dkurt dkurt mentioned this pull request Dec 19, 2023
10 tasks
@asmorkalov asmorkalov merged commit 3e6dcdc into opencv:4.x Dec 19, 2023
@asmorkalov asmorkalov mentioned this pull request Jan 19, 2024
thewoz pushed a commit to thewoz/opencv that referenced this pull request May 29, 2024
Add blobrecttoimage opencv#24539

### Pull Request Readiness Checklist

resolves opencv#14659

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work opencv#14659
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
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.

blobFromImage and crop

3 participants