Go to Post Seriously, when I grow up (or if I grow up) I want to be just like Al. - Paul Copioli [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-10-2014, 01:02 PM
themagic8ball themagic8ball is offline
Registered User
AKA: Mike Weinand
FRC #0537 (Charger Robotics)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Wisconsin
Posts: 112
themagic8ball is on a distinguished road
BinaryImage Pixel Access

Does anyone know an easy way to get direct pixel access in a BinaryImage? Basically I just want a count of the 1 pixels vs the 0 pixels.
__________________
Reply With Quote
  #2   Spotlight this post!  
Unread 03-10-2014, 01:18 PM
connor.worley's Avatar
connor.worley connor.worley is offline
Registered User
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Berkeley/San Diego
Posts: 598
connor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond repute
Re: BinaryImage Pixel Access

GetNumberParticles looks like it will do what you want (return the number of 1s, total bits can be calculated based on image size). GetImaqImage will return an Image* that can be passed to imaqGetPixel.
__________________
Team 973 (2016-???)
Team 5499 (2015-2016)
Team 254 (2014-2015)

Team 1538 (2011-2014)
2014 Driver (25W 17L 1T)
日本語でOK
Reply With Quote
  #3   Spotlight this post!  
Unread 03-10-2014, 01:59 PM
themagic8ball themagic8ball is offline
Registered User
AKA: Mike Weinand
FRC #0537 (Charger Robotics)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Wisconsin
Posts: 112
themagic8ball is on a distinguished road
Re: BinaryImage Pixel Access

GetNumberParticles only works after a particle filter is applied, we tried that. imaqGetPixel may do the trick. Thanks!
__________________
Reply With Quote
  #4   Spotlight this post!  
Unread 03-10-2014, 03:26 PM
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 688
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: BinaryImage Pixel Access

(Info largely based off of Google searches)

Calling imaqGetPixel repeatedly will probably give you very bad performance. If you're using C++, try imaqGetImageInfo instead to get direct access to the pixel data. See here for an example of how to use it.

If you're using LabVIEW, there's a imaqImageToArray function, but this creates a copy of the image data, and so will be slower than the imaqGetImageInfo method.

You could also call imaqQuantify which returns summary statistics about the image, include the mean pixel value. You can multiply the mean by the pixel size of the image (width*height) to get the number of 1 pixels.
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
Reply With Quote
  #5   Spotlight this post!  
Unread 03-10-2014, 03:31 PM
themagic8ball themagic8ball is offline
Registered User
AKA: Mike Weinand
FRC #0537 (Charger Robotics)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Wisconsin
Posts: 112
themagic8ball is on a distinguished road
Re: BinaryImage Pixel Access

Appreciate the note on performance.
__________________
Reply With Quote
  #6   Spotlight this post!  
Unread 03-11-2014, 09:55 AM
faust1706's Avatar
faust1706 faust1706 is offline
Registered User
FRC #1706 (Ratchet Rockers)
Team Role: College Student
 
Join Date: Apr 2012
Rookie Year: 2011
Location: St Louis
Posts: 498
faust1706 is infamous around these partsfaust1706 is infamous around these parts
Re: BinaryImage Pixel Access

If you're using opencv, look into image moments.
__________________
"You're a gentleman," they used to say to him. "You shouldn't have gone murdering people with a hatchet; that's no occupation for a gentleman."
Reply With Quote
Reply


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 09:19 AM.

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