Comments (3)
Hello, I'm sorry but if you want to ask question, https://forum.opencv.org/ is better.
But because you said an exception that is not cv::Exception occurred, I comment it.
As the necessary information has not been shared sufficiently at this time, we are unable to investigate the cause.
So I believe only you can investigate it .
As first, please could you split investigation in to 2 steps ?
- Step1 ) Determine which is this problem in commonly part or Jpeg part.
- Step2 ) (If jpeg part) Determine where line make exception.
Step1 ) Determine which is this problem in commonly part or Jpeg part.
"can't write data..." message is output from here. This is commonly part.
opencv/modules/imgcodecs/src/loadsave.cpp
Lines 769 to 776 in dad8af6
This is commonly part. Could you try with BMP encoder?
- imwrite("1.jpg", t_frame[index]);
+ imwrite("1.bmp", t_frame[index]);
Step2 ) (If jpeg part) Determine where line make exception.
If this problem occurs with only "1.jpg", not "1.bmp". Please could you try to isolate the cause ?
JpegEncoder
is very simple.
Or please could you share more information, like before and after log, Mat information ?
(It is difficult to investigate without reproducible data.)
https://github.com/opencv/opencv/blob/4.9.0/modules/imgcodecs/src/grfmt_jpeg.cpp#L580
Appendix
There are different between source code and comment, so maybe it is hard to determine which is input Mat valid or invalid.
//* These judgements don't work.
if (t_frame[index].empty() || t_frame[index].dims <= 0 || t_frame[index].channels() <= 0) {
std::cout << "Mat is invalid." << t_frame[index].cols << ",h:" << t_frame[index].rows << std::endl;
}
else {
//* isContinuous: true type:16
std::cout << "Mat is valid,w:" << t_frame[index].cols << ",h:" << t_frame[index].rows << std::endl;
std::cout << "Mat isContinuous:" << t_frame[index].isContinuous() << ";type:" << t_frame[index].type() << std::endl;
}
For Jpeg Encoder...
t_frame[index].empty()
is needed.t_frame[index].dims <= 0
should bet_frame[index].dims == 2
. But usually it is not needed.t_frame[index].channels() <= 0
should be check 1 or 3.1920x1080
is OK, but it is not checked.isContinuous
is not important because JpegEncoder handle each lines.type:16
(CV_8UC3
) is OK, but it is not checked, only comment.
from opencv.
Hello, I'm sorry but if you want to ask question, https://forum.opencv.org/ is better. But because you said an exception that is not cv::Exception occurred, I comment it.
As the necessary information has not been shared sufficiently at this time, we are unable to investigate the cause. So I believe only you can investigate it .
As first, please could you split investigation in to 2 steps ?
- Step1 ) Determine which is this problem in commonly part or Jpeg part.
- Step2 ) (If jpeg part) Determine where line make exception.
Step1 ) Determine which is this problem in commonly part or Jpeg part.
"can't write data..." message is output from here. This is commonly part.
opencv/modules/imgcodecs/src/loadsave.cpp
Lines 769 to 776 in dad8af6
This is commonly part. Could you try with BMP encoder?
- imwrite("1.jpg", t_frame[index]); + imwrite("1.bmp", t_frame[index]);Step2 ) (If jpeg part) Determine where line make exception.
If this problem occurs with only "1.jpg", not "1.bmp". Please could you try to isolate the cause ?
JpegEncoder
is very simple.Or please could you share more information, like before and after log, Mat information ? (It is difficult to investigate without reproducible data.)
https://github.com/opencv/opencv/blob/4.9.0/modules/imgcodecs/src/grfmt_jpeg.cpp#L580
Appendix
There are different between source code and comment, so maybe it is hard to determine which is input Mat valid or invalid.
//* These judgements don't work. if (t_frame[index].empty() || t_frame[index].dims <= 0 || t_frame[index].channels() <= 0) { std::cout << "Mat is invalid." << t_frame[index].cols << ",h:" << t_frame[index].rows << std::endl; } else { //* isContinuous: true type:16 std::cout << "Mat is valid,w:" << t_frame[index].cols << ",h:" << t_frame[index].rows << std::endl; std::cout << "Mat isContinuous:" << t_frame[index].isContinuous() << ";type:" << t_frame[index].type() << std::endl; }
For Jpeg Encoder...
t_frame[index].empty()
is needed.t_frame[index].dims <= 0
should bet_frame[index].dims == 2
. But usually it is not needed.t_frame[index].channels() <= 0
should be check 1 or 3.1920x1080
is OK, but it is not checked.isContinuous
is not important because JpegEncoder handle each lines.type:16
(CV_8UC3
) is OK, but it is not checked, only comment.
Hello, I'm sorry but if you want to ask question, https://forum.opencv.org/ is better. But because you said an exception that is not cv::Exception occurred, I comment it.
As the necessary information has not been shared sufficiently at this time, we are unable to investigate the cause. So I believe only you can investigate it .
As first, please could you split investigation in to 2 steps ?
- Step1 ) Determine which is this problem in commonly part or Jpeg part.
- Step2 ) (If jpeg part) Determine where line make exception.
Step1 ) Determine which is this problem in commonly part or Jpeg part.
"can't write data..." message is output from here. This is commonly part.
opencv/modules/imgcodecs/src/loadsave.cpp
Lines 769 to 776 in dad8af6
This is commonly part. Could you try with BMP encoder?
- imwrite("1.jpg", t_frame[index]); + imwrite("1.bmp", t_frame[index]);Step2 ) (If jpeg part) Determine where line make exception.
If this problem occurs with only "1.jpg", not "1.bmp". Please could you try to isolate the cause ?
JpegEncoder
is very simple.Or please could you share more information, like before and after log, Mat information ? (It is difficult to investigate without reproducible data.)
https://github.com/opencv/opencv/blob/4.9.0/modules/imgcodecs/src/grfmt_jpeg.cpp#L580
Appendix
There are different between source code and comment, so maybe it is hard to determine which is input Mat valid or invalid.
//* These judgements don't work. if (t_frame[index].empty() || t_frame[index].dims <= 0 || t_frame[index].channels() <= 0) { std::cout << "Mat is invalid." << t_frame[index].cols << ",h:" << t_frame[index].rows << std::endl; } else { //* isContinuous: true type:16 std::cout << "Mat is valid,w:" << t_frame[index].cols << ",h:" << t_frame[index].rows << std::endl; std::cout << "Mat isContinuous:" << t_frame[index].isContinuous() << ";type:" << t_frame[index].type() << std::endl; }
For Jpeg Encoder...
t_frame[index].empty()
is needed.t_frame[index].dims <= 0
should bet_frame[index].dims == 2
. But usually it is not needed.t_frame[index].channels() <= 0
should be check 1 or 3.1920x1080
is OK, but it is not checked.isContinuous
is not important because JpegEncoder handle each lines.type:16
(CV_8UC3
) is OK, but it is not checked, only comment.
imwrite_('1.bmp'): can't write data: unknown exception
How can I catch this error, at the moment the program just exits
from opencv.
Step1
I said you should try with BMP encoder instead of JPEG encoder.
How about it ? Does it works well?
And please notice that we cannot help you and/or debug your program because no one can reproduce your problem in other environment,
If you don't want to investigate/debug, this problem will not fixed forever. If so, It is better to close this issue.
(BTW a quoting all of previous comment is not meaning.)
from opencv.
Related Issues (20)
- Try to speed up HashTSDF raycasting using triangle rasterization
- Implement TSDF integration weighting
- Oak-D DepthAI with OpenCV 4.9.0 on Windows HOT 5
- Strange behaviour of cv2.add operation HOT 5
- Cannot search function in opencv 4.10.0-dev online doc HOT 1
- Support decompression of tiled JPEG2000 images
- Warnings building documentation HOT 1
- Matrix formatter does not work for 0d and 1d cv::Mat HOT 1
- cv::Mat reshape does not support 1d and 0d arrays HOT 1
- CMake gapi option WITH_FREETYPE seems to be ignored
- sepFilter2D insufficient shared (device) memory when using UMat
- OpenCV: Using setDefaultAllocator() with custom allocator calls allocate() but not deallocate() - why?
- VideoCapture with FFmpeg and CUDA Hardware Acceleration Returns Empty Frames in OpenCV 4.7.0 HOT 3
- not declared in this scope
- Compilation crashes after 4a9b0f2 HOT 8
- Charuco detection has slowed down considerably since 4.6.0 HOT 1
- SCALABLE RVV with debug mode encounters failing tests HOT 6
- cudnn 9.0 support... HOT 1
- The function countNonZero produces wrong output on SCALABLE RVV with Debug mode HOT 5
- cv2 missing "dnn" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencv.