Re: Lizerd´s Pic and Place Projekt (paket kommunikations tän
Postat: 16 maj 2013, 11:30:29
Så du tror det kommer krävas lite mer för att lösa problemen med borttappade paket? Alltsa ackar, resends, sliding window osv?
Svenskt forum för elektroniksnack.
https://elektronikforumet.com/forum/
Kod: Markera allt
public void ConnectToCamera()
{
// Check if camera instance already is created
if (CameraCreated != false)
{
this.StopCapture();
}
// Try to create new camera instance
try
{
// point camera connection/channel to camera array id
CapWebCam = new Capture(Parameters.CameraID);
// Set resolution
CapWebCam.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, Parameters.Resolution_X);
CapWebCam.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, Parameters.Resolution_Y);
// CapWebCam.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_AUTO_EXPOSURE, 0);
CapWebCam.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_BRIGHTNESS, Parameters.Brightness_Defualt);
// If made it this far the camera is enabled
CameraCreated = true;
}
catch (NullReferenceException except)
{
MessageBox.Show("Error in Camera.ConnectToCamera !!" + System.Environment.NewLine + except.Message);
CameraCreated = false;
}
}
Kod: Markera allt
public Image<Bgr, Byte> CaptureFrame()
{
if (CapWebCam != null)
{
Image<Bgr, Byte> CapturedImageFrame = CapWebCam.QueryFrame();
return CapturedImageFrame;
}
else
{
MessageBox.Show("Error in Camera.CaptureFrame !!" + System.Environment.NewLine + " Can not capture frame from selected camera!!");
return null;
}
}