Go to Post Sometimes I think all the Game Hint does to us is make us terrible listeners. - Chris is me [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 04-02-2012, 22:03
SoyStuff SoyStuff is offline
Registered User
FRC #1257
 
Join Date: Jan 2012
Location: Brooklyn
Posts: 29
SoyStuff is a jewel in the roughSoyStuff is a jewel in the roughSoyStuff is a jewel in the rough
Image Analyzing

Is it possible to simply analyze, pixel by pixel, and image from the axis camera as I would if were using the GetDiBits function in Win32? I would like to be able to analyze a raw image as a character array or an array of some sort. Is that possible?
  #2   Spotlight this post!  
Unread 05-02-2012, 00:20
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Image Analyzing

It would certainly be possible; however, it may not be plausible or practical. Java, for example, lacks a lot of the features you'd use for image processing (primarily pointers and non-reference structures). In C++ it would much more simpler to do, but it may be more practical in most cases to use NIVision's rather comprehensive IMAQ functions. I can't claim to know everything about how the images are presented in C++ (I am using Java), but I would assume that a pointer to the image data, the format of the image data (color format and channel resolution), and the size of the image are all accessible. If this is true, then processing the pixel data yourself is perfectly plausible, if not entirely practical.
  #3   Spotlight this post!  
Unread 05-02-2012, 01:01
SoyStuff SoyStuff is offline
Registered User
FRC #1257
 
Join Date: Jan 2012
Location: Brooklyn
Posts: 29
SoyStuff is a jewel in the roughSoyStuff is a jewel in the roughSoyStuff is a jewel in the rough
Re: Image Analyzing

Quote:
Originally Posted by Ginto8 View Post
It would certainly be possible; however, it may not be plausible or practical. Java, for example, lacks a lot of the features you'd use for image processing (primarily pointers and non-reference structures). In C++ it would much more simpler to do, but it may be more practical in most cases to use NIVision's rather comprehensive IMAQ functions. I can't claim to know everything about how the images are presented in C++ (I am using Java), but I would assume that a pointer to the image data, the format of the image data (color format and channel resolution), and the size of the image are all accessible. If this is true, then processing the pixel data yourself is perfectly plausible, if not entirely practical.
But how exactly do I get access to the raw data in the lowest level possible?
  #4   Spotlight this post!  
Unread 05-02-2012, 01:17
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Image Analyzing

The exact method would depend on the language, but you generally want a few things: a pointer to the image data, a width and height, and color information, primarily format (RGB, RGBA, BGR, grayscale etc.) and channel depth (a 32-bit RGBA image has 4 color channels, and therefore has an 8-bit channel depth. A 24-bit RGB image has only 3 channels but the same channel depth). Once you have this, accessing the nth (where n=0 is the first) channel of a specific pixel would go something like this:
Code:
pixels[(y*width+x)*bytesPerPixel + n]
where bytesPerPixel would be 4 for a 32-bit image, 3 for a 24-bit image, etc., x and y are in pixel units, width is the number of pixels per scanline, and pixels is a byte*, byte[], uint8_t*, uint8_t[], or whatever byte array or byte pointer type is provided by your language of choice.
  #5   Spotlight this post!  
Unread 05-02-2012, 06:46
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,756
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Image Analyzing

Yes it it, but since that doesn't take advantage of any of the advanced libraries available, that is almost certainly going to be a difficult and slow way to accomplish much.

To do it in LabVIEW, you use the functions listed below. You can use the first of them, then loop through them, index them randomly, etc. The second is used to put the pixels back.

If you go this route, I'd suggest identifying the sorts of algorithms you are looking for and using lots of reference textbooks on image processing. You will also need to pay much more attention to the language quirks for performance.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2012-02-04 at 9.31.31 PM.png
Views:	31
Size:	24.2 KB
ID:	11728  Click image for larger version

Name:	Screen Shot 2012-02-04 at 9.32.24 PM.png
Views:	22
Size:	20.6 KB
ID:	11729  
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 01:44.

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