Go to Post Everyone has regrets in robotics- it's how you learn from them that makes all the difference. - Kevin Leonard [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 14-01-2012, 13:47
Stonemotmot Stonemotmot is offline
Registered User
FRC #0486
 
Join Date: Sep 2011
Location: United States, Pa
Posts: 53
Stonemotmot is an unknown quantity at this point
How to preform a convex Hull operation in C++

Hello, I am working on vision tracking right now and was wondering how to implement the Convex Hull operation seen in the white papers(ni vision assistant) into C++. If there is a function or combination of functions to do this I would appreciate it.
  #2   Spotlight this post!  
Unread 14-01-2012, 13:59
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: How to preform a convex Hull operation in C++

One function you could use would be
int imaqConvexHull(Image* dest, Image* source, int connectivity8);

It is documented in C:\Program Files\National Instruments\Vision\Documentation\NIVisionCVI.chm,
and the header file is I believe in nivision.h, and the library is probably nivision.out.

Greg McKaskle
  #3   Spotlight this post!  
Unread 14-01-2012, 14:17
Stonemotmot Stonemotmot is offline
Registered User
FRC #0486
 
Join Date: Sep 2011
Location: United States, Pa
Posts: 53
Stonemotmot is an unknown quantity at this point
Re: How to preform a convex Hull operation in C++

Thank you could you be more specific on how to impliment that function for exaple would I say
image->imaqConvexHull(Image* dest, Image* source, int connectivity8);
obviously with diffrent names.
  #4   Spotlight this post!  
Unread 14-01-2012, 14:37
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: How to preform a convex Hull operation in C++

Quote:
image->imaqConvexHull(Image* dest, Image* source, int connectivity8);
Close, but the vision calls are just C functions, not C++ methods. The function takes in two Image* params, one for the destination and one for the source. I'm not sure what type your image-> is, so I'm not sure if that is the appropriate type to pass in or not.

The Image* referenced above is expected to come from Image* imaqCreateImage(ImageType type, int borderSize); or similar calls to load or create an NI Image.

By the way, the PDF about CVI is also a good source of how to use the library. You may also find it useful to look at examples such as C:\Program Files\National Instruments\Vision\Examples\MSVC\Threshold And Label


Greg McKaskle
  #5   Spotlight this post!  
Unread 14-01-2012, 14:48
Stonemotmot Stonemotmot is offline
Registered User
FRC #0486
 
Join Date: Sep 2011
Location: United States, Pa
Posts: 53
Stonemotmot is an unknown quantity at this point
Re: How to preform a convex Hull operation in C++

The current image type is not imaq image. But I think I know how to convert it. so asuming it was and I wanted to replace the current image with the result of the convex hull would I say.

image->imaqConvexHull(Image* image, Image* image, int connectivity8);

or

image->imaqConvexHull(image, image, connectivity 8);

do you know what connectivity 8 means?
  #6   Spotlight this post!  
Unread 14-01-2012, 15:22
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: How to preform a convex Hull operation in C++

The manual will explain it better, but the 4 versus 8 connectivity determines whether the diagonals on the pixels are considered as part of the particle. I think 8 is the better choice typically.

The usage is

int imaqConvexHull(Image* dest, Image* source, int connectivity8);

where Image* is the NI Image type. You need to convert or access inner buffer pointers or whatever the Image class is that you were using.

Greg McKaskle
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:07.

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