I'm doing projects using camera IP source onvif, but i can't catch exception when initialization new capture camera :
I'm start app debug but System Suspended by code new Capture(source ovif) , can't show exception. Thanks you.
try using "Exception" in catch statement.
try
{
....
}
catch(Exception ex)
{
MessageBox.Show(ex.ToSting());
}
Is your camera online and internet speed is enough to receive video? Try to decrease video resolution. Maybe you got same bug as I - https://github.com/emgucv/emgucv/issues/22
Related
I tried to get sensor stream from HoloLens, so I used the HoloLensForCV.
(https://github.com/Microsoft/HoloLensForCV)
First, I checked that SensorStreamViewer project works, but few days later, I updated HoloLens and then it doesn't work. The error I receive is Access is Denied
HoloLens Camera view capture
HoloLens Privacy Camera capture
The Webcam capability in VS capture
And, I guess the error occurs in this part(SensorStreamViewer.xaml.cpp).
// Initialize MediaCapture with the specified group.
// This must occur on the UI thread because some device families
// (such as Xbox) will prompt the user to grant consent for the
// app to access cameras.
// This can raise an exception if the source no longer exists,
// or if the source could not be initialized.
return create_task(m_mediaCapture->InitializeAsync(settings))
.then([this](task<void> initializeMediaCaptureTask)
{
try
{
// Get the result of the initialization. This call will throw if initialization failed
// This pattern is docuemnted at https://msdn.microsoft.com/en-us/library/dd997692.aspx
initializeMediaCaptureTask.get();
m_logger->Log("MediaCapture is successfully initialized in shared mode.");
return true;
}
catch (Exception^ exception)
{
m_logger->Log("Failed to initialize media capture: " + exception->Message);
return false;
}
});
When I start others project like 'ComputeOnDevice', I can see an alert message window asking me allow to access camera. However, when I start 'SensorStreamViewer', I didn't see any alert message asking about camera access.
I started debugging, and confronted this error message.
Exception thrown at 0x772C3332 in SensorStreamViewer.exe: Microsoft C++ exception: Platform::AccessDeniedException ^ at memory location 0x0180E680. HRESULT:0x80070005 Access is denied.
WinRT information: The required device capability has not been declared in the manifest.
How can I solve this problem?
In your Package.appxmanifest file, you need to add the following capability.
<rescap:Capability Name="perceptionSensorsExperimental" />
i've using emgu cv 2.4.10 to create a RTSP stream viewer that will eventually be used with IP cameras. as i don't have the camera/s as yet, i'm testing using VLC (the windows GUI) to create the stream from a video file.
:sout=#duplicate{dst=rtp{sdp=rtsp://:8554/stream},dst=display} :sout-all :sout-keep
i'm doing this all testing on localhost.
here's my capture code:
private void ProcessFrame(object sender, EventArgs arg) {
try {
frame = _capture.QueryFrame();
pictureBox1.Image = frame.ToBitmap();
}
catch (Exception ex) {
MessageBox.Show(ex.Message.ToString());
}
}
this method is called using this eventhandler:
_capture = new Capture("rtsp://localhost:8554/stream");
Application.Idle += ProcessFrame;
_capture.Start();
the capture is corrupted with random occurrences of "smearing" that always occurs in the lower portion of the frame:
i've seen several others online have reported this problem as recently as last december but no solution has been found or that would work for me:
http://workingwithcomputervision.blogspot.co.uk/2012/06/issues-with-opencv-and-rtsp.html
EMGU QueryFrame returns "streaky" Image over RTSP
http://www.emgu.com/forum/viewtopic.php?f=7&t=4882&p=10110&hilit=rtsp#p10069
to narrow down the problem, i've run ffplay from the commandline and the capture is perfect. i've run another instance of VLC to capture the RTSP stream and it displays perfectly. so this is clearly a problem in open cv/emgu cv.
on a whim, i changed VLC to stream using HTTP.
:sout=#duplicate{dst=http{mux=ffmpeg{mux=flv},dst=:8080/stream},dst=display} :sout-all :sout-keep
this displays fine in my code, but at a noticeably lower frame rate that won't work for my application. i'd really appreciate any tips to fixing this problem. thanks.
I don't know if you solved your problem but i suggest you not to make your process in application.idle event. Instead, use thread. Create another thread and make your proccess in it. Example c# code:
Thread t = new Thread(new ThreadStart(()=>{ while(true) {frame = _capture.QueryFrame();
pictureBox1.Image = frame.ToBitmap();}})); t.IsBackGround = true; t.Start();
I am doing simple program to detect webcam, it runs for some time but than I am getting the error message.
i took the code from,
https://thefreecoder.wordpress.com/2012/09/11/opencv-c-video-capture/
Unhandled exception at 0x74f22f71 (KernelBase.dll) in cvtest.exe: Microsoft C++ exception: cv::Exception at memory location 0x0109f524..
how to solve this problem.
Thank you very much in advance.
You could put the entire code within the try catch block
try
{
// ... Contents of your main
}
catch ( cv::Exception & e )
{
cout << e.msg() << endl;
}
This might help you! or Try with the debugger which line cause the exception.
I have an application that processes data from bluetooth and send it to the web service. Recently there was a request to add sounds to the application. Now when the application processes batches of data and the player is playing constantly after a few secs I get "Application is not responding" exception. And then the process is terminated. In the logs I can see lots of ForcedStackTrace exception logged after this exception.
The sounds are played in the separate thread. If app doesn't play sounds or plays short sounds - everything works fine. Is there any way to avoid this exception happening? Why is it happening?
InputStream mediaStream = null;
try {
mediaStream = getClass().getResourceAsStream(relativePath);
getLogger().log("setting player _ " + _audioType);
setPlayer(Manager.createPlayer(mediaStream, _audioType));
_currentPlayer.addPlayerListener(this);
_currentPlayer.setLoopCount(1);
_currentPlayer.realize();
VolumeControl vc = (VolumeControl) _currentPlayer
.getControl("VolumeControl");
if (vc != null) {
vc.setLevel(_voumeLevel);
}
_currentPlayer.prefetch();
_currentPlayer.start();
} catch (Exception e) {
}
(crossposted from BB forums)
Resolved by implementing my own PlayerManager, which, running in a separate thread would play the item in the queue manner rather then having many threads using the inner Player implementation.
I am using jxa-1.0 to create Instant Messaging application in blackberry while running the application i m getting exception like "java.io.IOException: Stream closed".Could you please tell me how to fix this?? or if u have prior experience with Jxa-1.0 pls share your ideas about how to use this one.
If you want to avoid this error on simulators, you should read the InputStream one byte at a time, try this code (consider NOT using this method when working with a real device, since performance will be affected):
InputStream is = httpConnection.openInputStream();
int data = -1;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
data = is.read();
bos.write(data);
while (data >= 0) {
try {
data = is.read();
} catch (Exception e) {
// Replace exception with "-1". This is to handle anomalous End-of-Stream in OS 5.
data = -1;
}
bos.write(data);
}
byte[] byteArray = bos.toByteArray();
If you are seeing this error message in a simulator, don't be surprised. I see I/O errors like this quite often in simulators, especially over Direct TCP or Wi-Fi connections. Some of the newer 5.0 simulators seem to be more problematic than older ones.
If you haven't yet, try it on a real device and it will probably be better.