It seems to be too many times "already answered" topic, but nonetheless I was not able to find a workable solution. I need to serialize IplImages and Mats with JavaCV. I cannot use the file system, ad I must stick to JavaCV 1.2/JavaCPP 1.2.4/OpenCV 3.1 (note: I cannot use the OpenCV's own Java wrapping - I have to work with JavaCV). I found a number of recommendations on Stackoverflow, but they all either: 1) use a deprecated method, or 2) use methods which no longer exist. I am aware that IplImages and Mats are easily interchangeable, so a solution for one would be readily applicable for the other. The ideal solution would be a way to convert IplImage/Mat to byte array and back. I hope you guys can help.
IplImage/Mat to byte array and back with JavaCV 1.2
1.9k views Asked by lcofresi At
1
There are 1 answers
Related Questions in SERIALIZATION
- Deserialize XML with optional different name
- How to serialize Any with Kotlin serialization?
- Flink Stuck on Broadcast
- How do I add serialization into Kotlin Jet Compose project?
- fix django login bug
- How to execute code "before_serialize"? or How can I sanitize attributes before they are serialized?
- Ical.net Serialization Error when serializing 12:00 AM Midnight
- how can i unserialize Symfony transport messages?
- How to change a queryset in Django?
- How to serialize object to JSON format which inherits IList and has other properties
- Json.stringify() is ignoring a object property after xlsx.sheet_to_json
- how to make aiogram.Message from telethon.Message
- implementin filter for vector of custom struct in RUST
- How to properly Serialize/Deserialize an ArrayList with Custom Objects?
- Append serialized objects to a single file and load Rust
Related Questions in JAVACV
- I am working on a face recognition system using JavaCV. I am using both OpenCV and JavaCV
- JavaCV ffmpeg video/audio not syncing
- How to pass fps_mode option when recording rtsp stream?
- Could not initialize class org.bytedeco.opencv.opencv_core.MatVector
- How to add gif as a top layer to video with javaCV?
- Error recording audio with FFmpegFrameGrabber
- Convert Frame to BufferedImage using JavaCV
- Cannot open RTMP stream with FFMPEG Java Cannot assign requested address
- How to Gradle load JavaCV binaries only for current platform?
- JavaCV: jniavutil.dll - Cannot access the file. The file is being used by another process
- android gradle file having duplicate classes
- JavaCV error AAC with no global headers is currently not supported
- Is it feasible to create FFmpegFrameGrabber one by one for single FFmpegFrameRecorder and maintain video stream keep alive?
- JavaCV DNN RetinaFace Model how to get the face and landmark information
- Error setting option use_wallclock_as_timestamps to value 1 in FFmpegFrameGrabber - avformat_open_input() error -22
Related Questions in IPLIMAGE
- How to compare two image with c
- Can't convert Bitmap to IplImage
- Translucent objects on IplImage
- Use IplImage (and C APIs) in opencv 4
- Convert an IplImage to SDL_Surface with single nChannals
- OpenCV 2.4 : C API for converting cvMat to IplImage
- ValueError: Fileobj must implement read
- OpenCV: cvCloneImage and memory leak
- OpenCV: Why *p_img1=*p_img2 is not correct
- How can I know the Gaussian blur coefficients of iplimage?
- how to display IplImage in an javafx imageview
- Conversion from *UMat to Iplimage
- JavaCV Convert color HSV2RGB very slow
- IplImage/Mat to byte array and back with JavaCV 1.2
- How to remove this Error "The method getBufferedImage() is undefined for the type opencv_core.IplImage"
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
I have a solution for the most recent JavaCV. Actually, several. I was having trouble with some images so my second attempt at conversion to a byte array produced a more consistent result. The solutions here are in Scala.
To convert to a byte array with the image data, you need to get the bytes.
Convert to a java.nio.ByteBuffer, use the total size from your image (I converted to a mat), and get the data. I forget whether m.total * m.channels returns a double, a long, an int or a float. I was using .toInt in Scala.
Another option is to use a BufferedImage. Some of my images were coming out a little odd using just JavaCV.
To convert from a byte array to an IplImage, I actually use a Buffered Image for reliability.