Go to Post You do know that totes are supposed to go through the chute right? Not humans? - themccannman [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 27-07-2013, 23:21
Chadfrom308's Avatar
Chadfrom308 Chadfrom308 is offline
Slave to the bot
AKA: Chad Krause
FRC #0308 (The Monsters)
Team Role: Driver
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Novi
Posts: 272
Chadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to behold
Vision processing problem (black, jittery images)

I have been working on an image processing system for recognizing 2012 basket balls. I have it working really well except for the very end, where it gives me a black image that switches between black and color really quickly for some reason. I compressed it and lowered the framerate to where my computer can handle it. the Vision tool says I can do it at around 25fps and i have it set to 15.

It seems to be the image processing itself that is creating the stuttering images. I have it working on a standard, default driverstation and even then it doesnt work with the processing. Without the processing, it is fine and clear as day. Can anyone help me?

Here is my code:
http://puu.sh/3NtmX.png

Here is what I see most of the time:
http://puu.sh/3NtpZ.png

The Code (a little walk-through):

I start with the standard read image, and put it though some processing.
The math at the top right simply puts the circle detection data onto the output image. I want the image to display a color image with a green circle around the ball, and for the most part, it does. For some reason it is getting black frames in it.
  #2   Spotlight this post!  
Unread 28-07-2013, 01:00
SoftwareBug2.0's Avatar
SoftwareBug2.0 SoftwareBug2.0 is offline
Registered User
AKA: Eric
FRC #1425 (Error Code Xero)
Team Role: Mentor
 
Join Date: Aug 2004
Rookie Year: 2004
Location: Tigard, Oregon
Posts: 486
SoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant future
Re: Vision processing problem (black, jittery images)

Does it make any difference if you set your speed to something much lower than what speed you think you ought to be able to do?
  #3   Spotlight this post!  
Unread 28-07-2013, 15:22
jerry w's Avatar
jerry w jerry w is offline
Free Agent Mentor
no team (Team Krunch)
Team Role: Engineer
 
Join Date: Nov 2003
Rookie Year: 2002
Location: dunedin fl
Posts: 113
jerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud of
Re: Vision processing problem (black, jittery images)

This process, as coded, would normally show a black screen, with an overlay of a circle.
I would suggest that you define 3 IMAQ memory spaces outside the loop.
1. The first one would hold the streaming images from the camera.
2. the second should hold a fixed copy of one image.
3. The third would be your working memory area. (similar to the random one you now show)
4 . In the loop, copy the latest image from the camera to the fixed memory and also the working memory.
5 After processing, put the overlay onto the fixed image.

By trying to store everything in one memory space, you are sometimes displaying streamed camera images and sometimes processing images.

Hope this helps.

Jerry
__________________
Happiest when people tell the truth... However, I am blessed with many friends.
  #4   Spotlight this post!  
Unread 28-07-2013, 21:52
DELurker DELurker is offline
Former Engineering Mentor
AKA: William Lydick
no team (n/a)
 
Join Date: Mar 2011
Rookie Year: 2011
Location: Delaware, US
Posts: 268
DELurker has a brilliant futureDELurker has a brilliant futureDELurker has a brilliant futureDELurker has a brilliant futureDELurker has a brilliant futureDELurker has a brilliant futureDELurker has a brilliant futureDELurker has a brilliant futureDELurker has a brilliant futureDELurker has a brilliant futureDELurker has a brilliant future
Re: Vision processing problem (black, jittery images)

Quote:
Originally Posted by Chadfrom308 View Post
I have been working on an image processing system for recognizing 2012 basket balls. I have it working really well except for the very end, where it gives me a black image that switches between black and color really quickly for some reason. I compressed it and lowered the framerate to where my computer can handle it. the Vision tool says I can do it at around 25fps and i have it set to 15.

It seems to be the image processing itself that is creating the stuttering images. I have it working on a standard, default driverstation and even then it doesnt work with the processing. Without the processing, it is fine and clear as day. Can anyone help me?
Here are some suggestions based on my learning for how to do vision processing:
1) Start with a static image. Take a photo of the balls or even create a JPG or GIF with several red, orange, green, and blue circles on it. See if the code will detect the orange circles from the static image. This will tell you if there is a flaw in your processing algorithm.
2) Use a USB webcam attached to your development PC to track a mock-up of your targets, whether on paper or in miniature. The VIs for USB webcams are easy to download (and free). This will narrow down any IMAQ issues that you have.
3) Use the whole shebang with the robot and such to try it for real. If there's a problem at this stage, it probably has something to do with your communications link/bandwidth.

If you do each of these, you can narrow down which part of the system is giving you trouble.

I've attached a pic of my static image loading segment.
Attached Thumbnails
Click image for larger version

Name:	LoadImageToIMAQ.jpg
Views:	13
Size:	15.9 KB
ID:	15113  
__________________
----------------------------------------------
With 1370 --
2012 Rutgers District Event Champions with 1676/56
2012 Lenape District Event Finalists with 2191/1691

2013 TCNJ District Event QuarterFinalists with 1143/4750, Gracious Professionalism Award
2013 Bridgewater-Raritan District Event Semi-Finalists with 4285/223
2013 MAR Championship Finalists (Backup) with 222/11/1403; Gracious Professionalism Award
  #5   Spotlight this post!  
Unread 29-07-2013, 15:17
Chadfrom308's Avatar
Chadfrom308 Chadfrom308 is offline
Slave to the bot
AKA: Chad Krause
FRC #0308 (The Monsters)
Team Role: Driver
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Novi
Posts: 272
Chadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to behold
Re: Vision processing problem (black, jittery images)

Quote:
Originally Posted by jerry w View Post
This process, as coded, would normally show a black screen, with an overlay of a circle.
I would suggest that you define 3 IMAQ memory spaces outside the loop.
1. The first one would hold the streaming images from the camera.
2. the second should hold a fixed copy of one image.
3. The third would be your working memory area. (similar to the random one you now show)
4 . In the loop, copy the latest image from the camera to the fixed memory and also the working memory.
5 After processing, put the overlay onto the fixed image.

By trying to store everything in one memory space, you are sometimes displaying streamed camera images and sometimes processing images.

Hope this helps.

Jerry

Thank you so much, it made it work! I didn't realize that that's what happens. It is my first time doing vision tracking and I wanted to make it really nice and fast. Thank you!
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:10.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi