Skip to content

freetype: support 8UC1/8UC4 image #3288

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

Merged
merged 6 commits into from
Jun 25, 2022
Merged

Conversation

Kumataro
Copy link
Contributor

@Kumataro Kumataro commented Jun 19, 2022

Fix #2009 (Request for 8UC4)
Fix #3276 (Request for 8UC1)

Related opencv/opencv_extra#981

Pull Request Readiness Checklist

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
  • [ 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.
  • The feature is well documented and sample code can be built with the project CMake

@Kumataro Kumataro changed the title WIP: freetype: support 8UC1/8UC4 image freetype: support 8UC1/8UC4 image Jun 19, 2022
Copy link
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!

*/

CV_WRAP virtual void loadFontData(String fontFileName, int id) = 0;
CV_WRAP virtual void loadFontData(String fontFileName, long idx) = 0;
Copy link
Member

Choose a reason for hiding this comment

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

long

This type is not well supported by OpenCV bindings (Python/Java/etc)

int32_t has the same problem. It is better to keep int.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it has side effects, I agree to revert to the unfixed code.
Thank you for your comment !

putText(dst, "LINE_8 putText(th=2)" , Point( 240,565),FONT_HERSHEY_SIMPLEX, 0.5, col, 2, LINE_8);
putText(dst, "LINE_AA putText(th=2)", Point( 240,580),FONT_HERSHEY_SIMPLEX, 0.5, col, 2, LINE_AA);

#ifdef OUTPUT_FILE
Copy link
Member

Choose a reason for hiding this comment

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

We could use if (cvtest::debugLevel > 0) instead.

Details: opencv/opencv#18955

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function is very useful for me !I

I pushed a commit to use it, thank you very much!

- Revert 3rd argument type of loadFontData() to use "int".
- Use cvtest::debugLevel instead to OUTPUT_FILE define.
- Change type of idx_range list and ctol_range list to use "int".
- fix typo.
Copy link
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Well done! Thank you 👍

@alalek alalek merged commit 3951e03 into opencv:4.x Jun 25, 2022
@Kumataro
Copy link
Contributor Author

Thank you very much!!

@Kumataro Kumataro deleted the 4.x-issue_contrib3276 branch June 25, 2022 21:24
hakaboom pushed a commit to hakaboom/opencv_contrib that referenced this pull request Jul 1, 2022
freetype: support 8UC1/8UC4 image

* freetype: add parameter test

* freetype: support CV_8UC3 and CV_8C4

* freetype:fix for gcc5.4

* freetype: delete newline

* freetype:fix for python binding

* freetype: Revert 3rd argument type of loadFontData() to use int.

- Revert 3rd argument type of loadFontData() to use "int".
- Use cvtest::debugLevel instead to OUTPUT_FILE define.
- Change type of idx_range list and ctol_range list to use "int".
- fix typo.
@alalek alalek mentioned this pull request Aug 21, 2022
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.

Relax the restriction of 3-channel FreeType::putText write to 4 channels Mat (BGRA)
2 participants