Skip to content
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

iOS imwrite crash #19635

Open
zKidor opened this issue Feb 27, 2021 · 8 comments
Open

iOS imwrite crash #19635

zKidor opened this issue Feb 27, 2021 · 8 comments

Comments

@zKidor
Copy link

zKidor commented Feb 27, 2021

System information (version)
  • OpenCV => 4.1.2
  • Operating System / Platform => iOS 14.1
  • Compiler => opencv2.framework download from opencv.org
Detailed description

imread(string) is succ.
but call imwrite(string,mat) crash.
image

And no crash msg occur.
How can i fix this?
thanks you.

@alalek
Copy link
Member

alalek commented Feb 27, 2021

4.1.2

Please try latest release.

crash

If it is crash please provide relevant stacktrace
if it is an exception then use try-catch to dump message.


Did you try to write data to your "target" file? (using C/C++ directly: fopen/fwrite orstd::fstream)

@zKidor
Copy link
Author

zKidor commented Mar 1, 2021

I add try-catch block , but also crash , and could not catch the exception.
I'm sure that the target file is exist in the file system . The target file can be wrote with swiftcode.

image

image

@alalek
Copy link
Member

alalek commented Mar 1, 2021

Thank you for update!

Perhaps we need to run with OpenCV framework with enabled debug information or built in debug mode to get actual stack trace.
(need to install modern CMake + Xcode command-line tools as prerequisites)

@zKidor
Copy link
Author

zKidor commented Mar 1, 2021

Hi, @alalek ,
I have install xcode-select and cmake.
How to get actual stack trace?

image

@alalek
Copy link
Member

alalek commented Mar 1, 2021

Check:


How to get actual stack trace?

Build new framework using the instructions above (with debug information)
Update your project with new framework (dump cv::getBuildInformation() to ensure that it is updated)
Hopefully Xcode would show more relevant data.

@zKidor
Copy link
Author

zKidor commented Mar 3, 2021

Hi @alalek
I have rebuild the opencv framework 4.5 with opencv contrib.

python opencv/platforms/ios/build_framework.py ios --contrib opencv_contrib

But it also crash with imwrite(String,mat) on iOS 14.
And there is no crash msg or stack
image

I also modify the build_framework.py in platform/ios/

image

and crash in
jpeg_create_compress

image

Can it help?

I take the same input image (.png) , on Android , call imwrite(string,mat) , it can be done . on iOS , it crash.

@zKidor
Copy link
Author

zKidor commented Mar 11, 2021

Hi @alalek ,
Is there any update for my issue ?

@hellodoge
Copy link
Contributor

Hello, @alalek

3rdparty/libjpeg-turbo/src/jpeglib.h:

* NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.

Consider moving the jpeg_create_compress line two lines down.

@hellodoge hellodoge mentioned this issue May 9, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants