lock device (webcam) from other applications - c#

I have an application that captures an image from a webcam.
I noticed that if I have Microsoft LifeCam installed in my computer, when starting the device from c#, Windows will start LifeCam automatically.
Obviously the easy way out is to uninstall LifeCam but is there a way to lock the device to my application only? The reason being is because I set image size, brightness, exposure, etc and when LifeCam starts, all of my settings are set to default.

Not that I know of. LifeCam is most likely using DirectShow to access the camera and while some directshow filters allow concurrent access, there isn't anything in the DirectShow API to let you prevent another application from trying to instantiate the driver. Usually what happens is that the second application gets a bunch of errors saying "Device in use", but sometimes not.
I think your best bet here is to just uninstall the lifecam software.

Related

Lime Video SDK - Windows10 quick sync config

I compiled fine the Samples in Lime Video SDK. On a Windows 7 system works very well but I got error message in a Windows 10 system.
"You are not properly configured for either: A) GPU/IGP Quick Sync B) Software fallback
You may not continue until you fix one option for Quick Sync coding
Press a key to exit"
I don't know what is the problem. I dug the source but not found a solution.
This message simply means that you have not installed the correct Intel HD graphics driver for your OS/CPU combination, or libmfxsw64.dll/so cannot be found in the DLL path, which is the software emulation fallback.
Without the correct device driver or the software fallback DLL/so being loadable, the samples will not be able to run.
What’s the best way to be sure you have drivers setup correctly?
Use either or both of: “MediaSDK System Analyzer“ or ffmpeg with the “-vcodec h264_qsv” option. Sorry for slow response, just noticed this.

Using Multiple Kinect v2 on one PC

I'm currently attempting to use multiple Kinect v2.0s as part of my dissertation. I've looked around on the subject and I'm aware of the issue with usb bandwidth so the two Kinects I'm currently using are on different usb controllers.
The issue I'm having is that as part of the GetDefault() function (2.0 SDK) it, as the name suggests, simply gets the default Kinect. Is there a way of either determining which Kinect to 'get' or determining which Kinect is the 'default'? (I know the SDK only allows for one but I'm exploring the idea of having a separate application handling each Kinect).
Thanks in advance for any input.
Using the Microsoft SDK you don't have a chance to use multiple Kinect2 on one PC:
Sensor Acquisition and Startup
Kinect for Windows supports one sensor, which is called the default sensor. The KinectSensor Class has static members to help configure the Kinect sensor and access sensor data.
Kinect API Overview
We tried similar things, but in the end we settled with a client/server-Solution where additional Kinects are connected to client PCs. But, even here you need to be careful if those Kinects are used in the same room - the sensors might pick up light from the other emitters! (see here e.g.: Interference between multiple Kinects).
Another thing you need to keep in mind when working on an client/server-solution - the Kinect does not handle Remote Desktop Connections very well:
Remote Desktop
If you are accessing the Kinect using Remote Desktop, You must change the remote desktop audio settings to "play on remote machine". If you do not do this, the runtime will not be able to see the audio device, and may disallow connection to the Kinect. (2.0 SDK and Developer Known Issues)
Another way you could choose, is use OpenKinect, which is supposed to support multiple cameras (here, here, here, ...) but all this seems not so easy to achieve too. Also, during our tests we noticed that the depth values are different when using the official Microsoft SDK or the open source library, since there is a lot of black-box-magic happening in the official SDK.
Have you considered running a virtual machine in parallel on your machine? Just have the virtual machine ignore the USB port that one of the kinects is on so the virtual machine is forced to use the other one.
This may require way more processing power than just plugging them in, but it should work, especially if you are trying to use them for two different programs.
Kinect for windows are only supported for virtual machines, (not including kinect for xbox one and kinect for 360 with adapters)

Run function in app from ms band

So I've had a look around and I cant seem to find an answer anywhere so here goes. Is it possible with the MS Band SDK to run a function within my app when the user taps a button?
Currently (at the time of writing) there is no way for the user to directly interact with a tile-app and thus pass a response to the application installed on the phone*
Your options are (as I see it):
To use the sensors to define 'gestures'**
Guide the user to use Cortana to provide speech commands ***
*This might change, but due to the very little storage capacity on the band if this was added I would assume only very basic interaction such as yes/no/cancel dialogos etc. and simpler responses using the keyboard when/if it becomes available for third party tiles.
**There is currently a bug with background work so you might have to prevent the lock screen from locking while receiving and interpreting sensor data on the phone which will impact the battery on the phone. This is expected to be fixed soon.
*** Speech commands are well supported on Windows Phone but I'm unsure how well supported they are on iOS and Android

laptop dual video cards - how to programatically detect and/or choose which one is used

We're developing software which uses DirectX for 3D rendering on Windows 7 and later machines, 64-bit C#/.NET code.
We've observed that a number of newer Dell laptops we're testing on have dual video cards. They have the Intel HD 4600 integrated graphics and they also have a faster NVIDIA Quadro card (for example).
By default, out of the box, the Intel graphics are used by the DirectX application. This is done, presumably to preserve battery life. But the performance is noticeably worse than the NVIDIA card.
Using the NVIDIA control panel, the user can control which one is used by default. As soon as the user switches it to use the NVIDIA card, the performance sees a big jump for the better.
So, my question is.... Is there any way to, in code, detect this setting and/or modify it for our application (on install and/or on launch)? Can we detect that for our app the Intel card is being used and if its one of these dual card scenarios, prompt the user and perhaps (if they request it) change the setting for them?
As it is currently we have to walk the users through manually making the change in the NVIDIA control panel.
Anyone else have any experience dealing with this and have any advice on how to proceed?
You could use C# DLL Interop to access functions of the NVML (NVidia Management Libraries) that are part of the GPU Deployment Kit (GDK). NVML includes functions such as the following for enumerating and selecting GPU devices:
nvmlInit()
nvmlDeviceGetPciInfo()
nvmlDeviceGetCount()
nvmlDeviceGetHandleByIndex()
nvmlDeviceGetHandleByPciBusId()
and
nvmlDeviceSetPersistenceMode().
However, many NVML functions require Admin access and a reboot to change settings. So these are only viable if your users are ok with this (perhaps during initial installation).
A better option would be to enumerate the Direct3D devices and select the most appropriate one: Enumerating with DirectX11, and Enumerating with DirectX9.
The answer is you can't, at least with some exceptions.
Laptops that has dual video cards usually comes with a software that switches your currently used card, either manually or automatically. There are others that can automatically detect the need of a software application for larger resources, thus automatically switching to nvidia card.
However, there are a few workarounds for this, please see this thread. In addition, I suggest that you manually set the default graphics card to nvidia for all your laptops in order to eliminate this issue.

can my windows phone application auto start?

Is there a way for my application to auto-start after some time instead of a notification? Or am I constrained to just notifications?
The difference between Android and Windows Phone (you mentioned Android in your comment) is that Android allows you to do pretty much everything while Windows Phone is a very restricted system. So, unfortunately, the answer is no. (There are ways to launch your app from other places than the app's tile, though. See the end of the answer)
Why am I saying unfortunately? Of course, Windows Phone is a nice and seek operating system that runs wonderful even on low-spec devices like the Lumia 520. But that doesn't mean developers shouldn't get the freedom to interact with the Operating System and do innovative tasks.
But there are reasons Microsoft chose not to allow Autostart (or at least, restrict the area an app can access, not the autostart in particular):
it may irritate customers. Even if you show a message box, many customers just dismiss it without reading it and they wouldn't understand why an app would appear without their interaction
each feature would make the operating system slower and bigger. I don't want to say that an autostart makes the phone unusable, but here's a question: Do you need to run a registry cleaner on you PC from time to time? Yes, you do need to do so You even need to reinstall a PC form time to time. You don't need to do that on a Windows Phone. It just works and will always work (OK, that's maybe a bit too optimistic, but you get it...)
I also don't think an autostart is particularly useful on a mobile. Because each app runs full screen, the system would boot up to your app instead of to the start screen. I don't think the user will always want your app (most of the time, he'll want to look at his start screen or launch another app), so it would just be annoying. On a PC, you can use the auto start for small programs that should run in the background (for example, I've got a progamm that provides Git with my SSH keys that automatically starts up each time).
But as I mentioned above, there are other ways to launch your app. Using url schemes can be surprisingly powerful as you can put a button on a web page that will directly launch your app. Other apps will also be able to launch your app. But as it is not directly what you wanted to know, I won't explain it in detail and instead provide you wiht a gread link to msdn: Auto-launching apps using file and URI associations for Windows Phone 8
For such features you should look into: Windows Embedded 8.1 Handheld instead of the consumer version Windows Phone 8.1.

Categories