OpenCV camera properties dialog - opencv

A few weeks ago I saw on the internet that you could display a small dialog/ menu with a few properties of the camera. In this menu the user can change the contrast, brightness...but I can not find it anymore. Does somebody know the code to get this dialog?
Thank you in advance!

Set the property CV_CAP_PROP_SETTINGS with any value.
cv::VideoCapture cap(0);
cap.set(CV_CAP_PROP_SETTINGS, 0); //opens camera properties dialog

OpenCV doesn't offer this functionality. Different camera manufacturers have different API's for accessing and changing camera parameters. There is no standard way to do this. So, you can try to access your camera settings using its API and then you can write your own GUI dialog window (for example, using QT library) to view/change the parameters.

Related

Mitov VideoLab camera controls

I am using Delphi and Mitov VideoLab 7.0.
I have a CMOS camera that is hooked to a microscope. When I take pictures I need to go to a white spot and correct the white balance. For that I need to use the cameras own control panel. This panel also comes with some other stuff like setting resolution.
Using Delphi XE3 and Videolab 7.
How can I show the camera controls in my Delphi app?
For that I need to use the cameras own control panel.
You don't explain if that control panel is camera's or Videlab's.
I will assume you refer that CP is generated by camera's software (driver).
So, here is the answer:
If you are lucky and the producer offers also an OCX you can import it in Delphi as then easily access the camera.
Check driver's folder. See if there are any OCX files there
Check producer's the web site
Ask the producer (and hope it will answer)
If there are no OCX files you might still be able to access the camera BUT won't be easy. You can use the camera's driver (DLL) files. But that involves some hacking.
Hi everybody I have solved my issue the following way:
Instead of using Mitov videoLab (btw its a great plug in) I used Vframes found here on StackOverflow:
Delphi Webcam Simple Program
I used this to show my camera controls
Cam.ShowProperty;
where Cam: TVideoImage
Moreover the Vframes lets me show the camera directly into TImage canvas so its very easy to capture and save to disk or database.
adotable1.FieldByName('pic').Assign(Image1.Picture.Bitmap);
Where pic is defined as image (im using MSSql Express).
To show the image back I use DBImage linked to the pic field..works like a charm.

Opencv cant access camera connected through video capture device

I have a analog camera connected to EasyCap video capture device. When I run a basic code which opens webcam video using OPENCV, I can access my in-built webcam but not the other analog camera.
How would you connect any other camera (FPV, IR, etc) to the PC such that OPENCV can access it.
Thanks.
i struggled with the same problem and hope it helps!
the original thread + ANSWER
also relevant XKCD
one more observation: from your description it looks like you already have a webcam running on the laptop (in-built webcam maybe?) you might want to disable it in system manager so as to guarantee that your analog camera cam_index is zero for certain. Otherwise if you leave the webcam enabled as a device, then your analog cam will most likely be incremented to cam_index=1 which amusingly enough seems to be confirmed by it crashing on cam_index=1.
Arguable not a great method to find your camera's index but there you have it!
You can set which camera to connect to open by changing the following deviceID to the desired device you want:
CvCapture* capture = cvCaptureFromCAM(deviceID);
or new API:
VideoCapture cap(deviceID);
Check out documenation for more info.
Use the deviceID of the analog camera instead of the in-built one.

Interactive video in iOS : Is it possible to trigger specific actions in code by tapping discrete parts in the video?

I am asking this because I couldn't find the answer anywhere, at least using the keywords I could think.
The most relevant question/answer I've found is : (Create interactive videos in iPad - An app for product demo) . The user Jano replied:
The easiest way to create interactive videos for iOS is to use Apple's HTTP Live Streaming technology. You have to create a video, embed metadata, play it using MPMoviePlayerController or AVPlayerItem, and then display clickable areas in response to metadata notifications.
Metadata should contain coordinates for the element you are tracking, eg: a dress, and a identifier for the product. You overlay this info with a clickable subview that reveals more information about the product. There are several applications of this kind in iTunes, here is one.
Once you get a working product and weeks-time of videos, the most difficult part is to perform motion tracking with the less possible human interaction. One approach is to use Adobe After Effects, another is to code your own solution based on OpenCV.
The example I've found concerning this technology (http://vimeo.com/16455248) showed the automatic addition of NSButtons when the video reaches the meta-tags embedded. My client wants a human body interactive video that pauses at a specific time (maybe using the meta-tags) and reacts to user tapping in an element in video (e.g: imagine a pill inside stomach; after tapping this pill it triggers another pre-rendered video, in a way not transparent to user). I have thought about animations using Cocos2D or Open GL ES, but I lack people who master these technologies.
I didn't quite understand the "motion tracking" reference in the quote above. Jano mentions Adobe After Effects and OpenCV. This motion tracking is like an "UIGestureRecognizer" ? Does it track parts of the video itself or motions initiated by user, as taps ?
I expect I've exposed the question in the most clear form possible. Thank you in advance.
This question is a year old, but I can give you insight into the After Effects question. AE has a feature where you can define an area in a video frame and the software will track that area across the timeline, logging the coordinates at specific intervals. For example, in a video of a person riding a mountain bike, you could select an area around their helmet and AE will log coordinates of the helmet throughout the timeline.
Since Flash was the most likely target for interactive video, the typical workflow would encode this coordinate data into a Flash video as cue point events (this is the only method I have personally experienced). According to some googling, the data is stored in key frames and can be extracted using scripts.
More info: http://helpx.adobe.com/after-effects/using/tracking-stabilizing-motion-cs5.html
Here's a manual method for extracting the data:
In the timeline panel select the footage and press the U key, all
track points keyframes will show up. Here’s the magic, select the
Feature Center property of each track point and copy it (Cmd+C for Mac
or Ctrl+C for PC)
Now open any text editor such as TextMate or Notepad and paste the
data (Cmd+V for Mac or Ctrl+V for PC)

How to find the source video size using VMR9 renderless mode

My application uses VMR9 Renderless mode to play a WMV file. I build a filter graph with IGraphBuilder::RenderFile and control playback with IMediaControl. Everything plays okay, but I can't figure out how to determine the source video size. Any ideas?
Note: This question was asked before in How can I adjust the video to a specified size in VMR9 renderless mode?. But the solution was to use Windowless mode instead of Renderless mode, which would require rewriting my code.
Firstly you want the Video renderer. You can do this by using EnumFilters on the IGraphBuilder interface. Then call EnumPins on that filter to find the input pin. You can then call ConnectionMediaType to get the media type being fed into that filter. Now depending what formattype is set to you can cast the pbFormat pointer to the relevant structure and from there find out what the video size is. If you want the size before that (to see if some scaling is going on) you can work your way back across the pin using "ConnectedTo" to get the next filter back. You can then find its input pins and repeat the ConnectionMediaType call. Repeat until you get to the filter's pin that you want.
You could use the MediaInfo project at http://mediainfo.sourceforge.net/hr/Download/Windows and through the CS wrapper included in the VCS2010 or VCS2008 folders get all the information about a video you need.
EDIT: Sorry I thought you were on managed. But in either case the MediaInfo can be used, so maybe it helps.

How do I fire a camera connected on USB programatically?

I want to make something like they have at US dmv's where you sit down and it takes your picture, maybe like photobooth.
I want to connect a high end camera via usb, fire the camera and get the picture.
There's the Picture Transfer Protocol http://en.wikipedia.org/wiki/Picture_Transfer_Protocol a nastly little thing. All the cameras I held in my hands so far, claiming they had proper PTP support failed it somewhere. But in theory one can use PTP to remote control a camera, i.e. trigger the shutter, retrieve the picture and so on.
Rater than reimplementing the whole thing I recommend you get some readily usable PTP library. There are some open source ones listed on http://ptp.sourceforge.net
The easiest method is probably to use OpenCV: http://opencv.willowgarage.com/wiki/
If you need a high end camera - most digital SLRs have a tethered mode where you can control the camera, fire the shutter and retrieve the image data. Each camera maker has a proprietary (but normally free) sdk.
For a webcam type camera - these normally run in video mode, you simply grab an image out f the video stream - as PaulR says - use openCV

Resources