|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Program crashing when grabbing USB Camera frame + misc comm issues
I'm trying to work on vision code or at least displaying a camera feed on the dashboard, but the program crashes on the function where I set the camera server frame. I know about the StartAutomaticCapture function but I'm trying to actually have each frame in memory so I can threshold it or w/e. I have a command that executes this every update time (5 ms or whatever the default is).
Code:
cam->GetImage(NIframe); CameraServer::GetInstance()->SetImage( NIframe ); Wait(0.1); Code:
while (start < dataSize - 1) {
if (data[start] == 0xFF && data[start + 1] == 0xD8) break;
else start++;
}
Code:
USBCamera *cam; Threshold *thresh; ColorImage *frame; Image *NIframe; BinaryImage *binaryFrame; |
|
#2
|
||||
|
||||
|
Re: Program crashing when grabbing USB Camera frame + misc comm issues
I'm a bit perplexed why you're trying to 'set' the camera frame at all. If you're looking to do image analysis, you'll want to 'get' the frame from the camera and then do analysis on it.
In the case of wanting it on the smartdashboard - that can be accomplished by adding the video pane to the smartdashboard directly. I think this is in the menus or it is a right-click on the dashboard to add it. No programming necessary. bob |
|
#3
|
|||
|
|||
|
Re: Program crashing when grabbing USB Camera frame + misc comm issues
Quote:
OP, you should check to make sure that you are actually getting a non-null image of non-zero size back from your call to GetImage. If you are calling GetImage every 20ms that's 50FPS which the camera can't provide, I haven't played with this enough to know if that's why your having an issue, but it would be my first suspicion. |
|
#4
|
|||
|
|||
|
Re: Program crashing when grabbing USB Camera frame + misc comm issues
Quote:
|
|
#5
|
||||
|
||||
|
Re: Program crashing when grabbing USB Camera frame + misc comm issues
I know that I have to power cycle the roboRIO when I upload code it can find the camera sometimes.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|