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
Problem converting frame to IplImage #2183
Comments
FFmpegFrameGrabber owns the Frame. You'll need to call stop() after calling convert(). |
And after calling cvShowImage(). |
Thank you for the specific answers. But I still can't get frames converted to IplImages. Here is some new code that focuses on the specific problem... I have two int control variables: doBuf and doIpl. They control whether I want to extract a video frame into a BufferedImage or an IplImage. If I set doBuf= 1; and doIpl = 0; then the code runs and correctly displays a very large full color image from the video frame. However, if I set doBuf= 0; and doIpl = 1; then the code runs but erroneously displays a fairly small monotone dark gray image that has no relation to the video. The two sections of code are NOT identical. But they are as similar as I can make them. I have no idea why one works and the other doesn't. Is there some easy fix that I'm overlooking, or do I have to use BufferedImages and give up on IplImages? |
Like I said, you'll need to move stop() and close() after cvShowImage() for this to work. It could also work if you clone() the image, but still again always before calling stop() and close(). |
I don't know whether to say Eureka, Hallelujah, or simply Thank You. My problem was that when you said the position of close() was essential, I didn't realize you were referring to converter.close(). I understand now. |
I'm not a beginner, but I've been away from javaCV for 12 years... My main program calls Video.getFrame(200). That program is using FFmpegFrameGrabber to grab a frame, OpenCVFrameConverter.ToIplImage() to convert it to IplImage, and cvShowImage to display it. When that code compiles there are no errors. But when it runs it hangs after printing of "Got here 5" and displaying a too small completely black image. So the cvShowImage is the point of failure. When I omit the cvWaitKey statements, there's an uncaught execution time exception.
FailureCode.txt
What am I doing wrong?
Earlier I got similar code to work converting to BufferedImage instead of IplImage, but I thought there might be some advantage to returning to things I was familiar with 12 years ago.
The code for Video.getFrame is shown:
FailureCode.txt
The text was updated successfully, but these errors were encountered: