-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Image is distorted when converting from OpenCVFrameConverter.ToOrgOpenCvCoreMat using a mp4 video #1460
Comments
That's a known limitation of the official Java API. Don't use it if you need custom strides like this, or please report upstream. |
If I use same video and extract frame from java2Dframeconverter and save bufferedimage, I get correct image. If we use OpenCVFrameConverter and get Mat image and save it the image get distorted and give schew/stretch or distort image. I think there is some problem with open cv converter. |
Like I said, this is a problem with the Java API of OpenCV. There is no such limitations with the C++ API of OpenCV. Instead of using Java API, please use the C++ API, and you will not have this issue. If you cannot use the C++ API of OpenCV, there is nothing else I can do here. Please report this issue upstream. |
ok got it now, i was thinking there was problem with java from your last comment, but its now clear to me its problem with Java API of OpenCV, i will try to find a work around and report this error. Thank you |
Actually, it looks like the Java API was fixed. There's a new constructor that we can use to set the stride here: |
Thank you, working perfectly. |
Im trying to converting Frame from to Mat but the image is distorted. below is the link of the video and code.
`package com.mi6.surf;
import org.bytedeco.ffmpeg.global.avutil;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.FrameGrabber.Exception;
import org.bytedeco.javacv.OpenCVFrameConverter;
import org.opencv.core.Mat;
public class Grabber {
}
`package com.mi6.opencv;
import org.bytedeco.javacpp.Loader;
import org.bytedeco.javacv.FrameGrabber.Exception;
import org.bytedeco.opencv.opencv_java;
import org.opencv.core.Mat;
import org.opencv.highgui.HighGui;
import com.mi6.surf.Grabber;
/**
*/
public class Test2 {
}
[Distorted Image
](https://1drv.ms/u/s!As2o7s_R_SwDghtwCI07dH87epJI?e=H8tMQG)Video Link
The text was updated successfully, but these errors were encountered: