"An invalid handle was specified" on OpenCV VideoCapture creation - visual-c++

I trying to get video from a webcam using OpenCV 2.4.5 and Visual C++ 2010, but when I try to initializate the VideoCapture
VideoCapture cap(1);
I get this error:
0xC0000008: An invalid handle was specified.
The camera is connected and working. I tryied with 0 and -1 as parameters, with the same result. If I continue the excecution of the program, ignoring the error, the cap variable is null.
According to what I've read somwhere else, if I excecute the generated .exe, the program works OK. But obviously I need to work inside Visual to debug properly.
Thanks in advance!

Please go through the cvSetCaptureProperty and also try to give the video input through the cvCaptureFromCAM, because cvCaptureFromCAM is specific api for camera.

Related

Issue with viewing data transformation with PyTorch

I am currently trying to process data for a simple network. This is the code I entered:
Screenshot here
I keep getting this error message but can't find any syntax problems or anyone else with this issue, I'm guessing it's something to do with my vienv because I've seen tutorials of people with no issues and that exact code. It's possible I haven't imported a package into my IDE and I am using anaconda and PyCharm if that helps.
Anyway, this is the error message I keep getting.
Error Message
You need to use transforms.ToTensor() instead of transforms.ToTensor when passing to transforms.Compose.

OpenModelica: No output variables or solution file

So I am a newbie to OpenModelica. I have a bit of experience using LMS Amesim. I created my first simple model using OM and simulated it from within the OMeditor.
When I switch to the plot window, there are NO output variables to plot. That tells me that the simulation may not have run. However, no error messages popped up. When I checked the model, I found it to be fine (not overconstrained or underconstrained).
What gives? This is OM 1.14 on Linux Ubuntu 16.04.
My Modelica file is a simple 2nd order system with feedback control is available via pastebin here or may be downloaded here via google drive link
The messages that I have from the output window are:
/tmp/OpenModelica_drN/OMEdit/Feedback/Feedback -port=35318 -logFormat=xmltcp -override=startTime=0,stopTime=100,stepSize=0.2,tolerance=1e-6,solver=dassl,outputFormat=csv,variableFilter=.* -r=/tmp/OpenModelica_drN/OMEdit/Feedback/Feedback_res.csv -w -lv=LOG_STATS -inputPath=/tmp/OpenModelica_drN/OMEdit/Feedback -outputPath=/tmp/OpenModelica_drN/OMEdit/Feedback
The initialization finished successfully without homotopy method.
The simulation finished successfully.
This was a bug. Should be fixed now:
https://trac.openmodelica.org/OpenModelica/ticket/5251

Euterpea Exception: No MIDI output device found

I am trying to get started using Haskell's Euterpea library. My first goal was to get it to play a given sound file (e.g. mp3 or wav), but first I ran into an issue following instructions to get it to just play a simple note sound in ghci.
Following the "Setting up MIDI" instructions at Euterpea's web page, I ran
import Euterpea
play $ c 4 qn
in ghci. The 'play' command resulted in the following error message:
Prelude Euterpea> play $ c 4 qn
*** Exception: No MIDI output device found
CallStack (from HasCallStack):
error, called at ./Euterpea/IO/MIDI/MidiIO.lhs:122:18 in Euterpea-2.0.2-Iz37iWlkpjn2emP4FnvOI1:Euterpea.IO.MIDI.MidiIO
I thought I needed to specify midi output to my machine (macOS Sierra) and found an application called 'Audio MIDI Setup', but it showed that a midi output (my internal speakers) was already specified.
Anyone know what this issue is or how to fix it?
Perhaps you solved this, but for posterity some ideas:
Sounds like you didn't install and run a MIDI synth (e.g. SimpleSynth) first. AFAICT, Audio MIDI Setup doesn't actually include a software synthesizer, it's more for advanced / hardware MIDI setup.
This should create the MIDI output devices that Euterpea couldn't find there. You may also need to play around with channels (e.g. use playDev n instead of play and work out a value for n from your device list... or even just try 1 through 8)
Either way there's some good Mac-focussed help on Donya's working with MIDI on Mac OS X page. Hope that helps.

mcc -mv in linux machine R2013a

When I am trying to make executable files of my .m-files on a Linux machine, some of the the .m-files are working absolutely fine.
However, one file which has camera input inside the .m-file is giving me this error:
Depfun error: 'Unexpected Standard exception from MEX file. What() is: ..' Error using mcc Error executing mcc, return status = 1 (0x1).
But when I use the same .m-file on Windows and R2012a it is working properly without any error.
I found a bug report here - is this a similar problem?
How do I solve it?
Here is the simple code of my .m-file:
function yuv()
vid1 = videoinput('linuxvideo', 1, 'YUYV_1280x960');
set(vid1,'FramesPerTrigger',1);
start(vid1);
imageData1=getdata(vid1,1);
imageData=ycbcr2rgb(imageData1);
imagesc(imageData(:,:,:,1));
end
I was getting the same Depfun error, "What() is: ..", under R2013a on Linux but no errors when using a different OS or an older MATLAB version to compile my code. Following the bug report you linked to fixed it for me.
In the zip file linked to in the bug report you'll find a depfun.opts file. Rename or move your original depfun.opts file that's located in [matlabroot]/toolbox/compiler and copy the new one in its place.
Putting the new depfun.opts file in place is all it took for me to be able to compile using R2013a on Linux.
Also note, the bug report says that it could be caused by the importdata function or the Parallel Computing Toolbox but I'm not using either of those.

Flashdevelop + haxe -- repeated "An I/O error has occured" errors

I'm getting small dialog boxes that pop up saying I/O Error occurred. What causes this, and how should I fix this?
Edit: what happens is that after i run my flash game, FlashDevelop will try to connect to the Flash debugger, but apparently fail and give me the above error. I have both the debug standalone player and the ActiveX debug control for Firefox.
To activate interactive debugging with haxe/Flash/FlashDevelop you have to add the fdb switch and network-sandbox. To do that open Project -> Properties -> Compiler Options -> Directives and add the following two lines:
fdb
network-sandbox
That should be all you need. After that you should be able to set breakpoints, inspect object fields and local variables and profile your code.
I didn't have haxe, but I had the same error and to get rid of it I followed the advice from here:
Specify the path to the debug player
(flashplayer_10_sa_debug.exe or
FlashPlayerDebug.exe in the SDK) in
FlashDevelop Tools > Program settings > FlashViewer

Resources