OpenCV delay in camera output on the screen - opencv

I noticed a strange thing about OpenCV. I used one of the basic sample C programs delivered with OpenCV to show the camera output on the screen. I, however, see the output on the screen with a tiny delay compared to what the camera sees. So if I move my hand in front of the camera, it will show up on the screen with about 0.1 second delay. We are developing an application that is very sensitive to these delays. Is there a way to remove this delay such that the image transfer is instantaneous? I don't see tiny delay when I look at my camera output via Skype, for example.
Thank you very much!
P.

The openCV highgui display window is only meant for simple display of image processing results - it's not optimised for high performance or low latency.
You will have to write something to talk between the videoinput library and whatever display lib you want to use.

Just to confirm - yes, once I turned off the highgui video output, the processing speed went significantly up and the FPS along with it. Now the app is capable of getting and processing frames at 80 FPS. One solution to similar problems that doesn't require writing a new video output library is to display only every, say, tenth frame of the video to save processing power.
Thanks

Related

Kurento - Blurness in the Remote stream stored images

What I did:
I am using Kurento Media Server to store the video streaming frames in the server. I can store the frames in the server by using opencv-plugin sample.
I am storing the video frames in the below two scenarios.
1) I need to take the images when the user show their faces in front of
the camera.(Note: No movements)
Issues: No issue. I can get the quality images.
2) I need to take the images when the user walks in a room.(Note: The
user is moving)
Issues: Most of the stored images are blurred in the server when they
are in moving (while walking).
What I want:
i) Is this the default behavior of the KMS (gstreamer)?
Note: I can see the local stream videos clearly in the browser while moving. But
the remote stream videos only got blurred while moving.
ii) Did anyone face this issue before. If yes, how do I solve this issue?
iii) Do I want to change any gstreamer configuration?
iv) Anyone give me a suggestion to overcome this issue?
The problem you are having is that the exposition time of your camera is high. It's like taking a picture of a car with low light.
When there is movement in the image, getting a simple frame, specially if the camera exposition time is long (due to low light conditions of low camera quality), will end in this kind of images.
On continuous video you don't notice this blurriness because there is a sequence of images, and your brain fills the gaps.
Edit
You can try to improve the quality that you are sending to the server by changing constrains on WebRTCEndpoint using properties setMaxVideoSendBandwidth and setMaxVideoRecvBandwidth. As long as there is available bandwidth you'll get a better quality.

Removing low frequency (hiss) noise from video in iOS

I am recording videos and playing them back using AVFoundation. Everything is perfect except the hissing which is there in the whole video. You can hear this hissing in every video captured from any iPad. Even videos captured from Apple's inbuilt camera app has it.
To hear it clearly, you can record a video in a place as quiet as possible without speaking anything. It can be very easily detected through headphones and keeping volume to maximum.
After researching, I found out that this hissing is made by preamplifier of the device and cannot be avoided while recording.
Only possible solution is to remove it during post processing of audio. Low frequency noise can be removed by implementing low pass filter and noise gates. There are applications and software like Adobe Audition which can perform this operation. This video shows how it is achieved using Adobe Audition.
I have searched Apple docs and found nothing which can achieve this directly. So I want to know if there exists any library, api or open source project which can perform this operation. If not, then how can I start going in right direction because it does looks like a complex task.

Disable camera shaking in ios

I am creating simple camera app and I want to add 'image stability' so when hands are shaking the camera does not twitch. Is it possible to do in iOS?
You can do this by getting the raw image from the camera, and only using a subset of the raw image frame, then programmatically picking a new subset for each raw image to use for the next frame. Needless to say, this is a large amount of work and should only be undertaken if you know what you are doing or want to have the most impressive video/picture taking app.
The iPhone 6+ has this built into the hardware and is, I believe, what the previous comment link to avfoundation is talking about.

iOS Video Creation Size

I am working on an app which is running some processing on the iOS AV Foundation video stream, and then generating a video using the processed output.
I'm noticing that if I make the output frames of the video too large, the processing time to render the video frames is too large, and my app gets choppy.
Does anyone have a good suggestion for a method I can use to determine at run-time what the largest video size I can create without affecting (drastically) the framerate of the video? This way, if the app is running on an iPhone 5, it should be able to create higher-resolution videos than if it's running on an iPhone 4.
One thought that I had was that before the recording starts, I could try and render a few frames at different resolutions behind the scenes, and time how long the render takes, and use the largest one is takes less than X, but if there's a better way, I'd love to hear it.
Another option would just be to experiment off-line with what gives me good performance on different devices, and hard-code the video resolution per device type, but I'd rather avoid that.
Thanks in advance!

Detect motion with iPad camera while doing other things

I have to have a video play-back in a loop, until I detect some motion (activity) with the front camera of iPad.
The video does not need to be recorder or played later, and I do not have to show the current video on the iPad.
Currently they have to tap the screen to stop the video but the customer wants a 'cool' video detection. I am not interested in face detection, just motion.
There are some examples about it ?
thanks,
EDIT
Well, currently the only workaround that I've found is detecting luminance... Just make an image of every frame (or n frame) and check the luminosity of the image, check another image from another frame and check again, if the variance is enough, something has changed :-)
Just find a good threshold variance and ready to go ...
Of course I would prefere a more robust workaround...

Resources