Go to Post A big bowl of popcorn and FIRST. It doesn't get much better than that. - Warren Boudreau [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 Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 11-12-2013, 17:01
Maxwell777's Avatar
Maxwell777 Maxwell777 is offline
Is allowed to touch stuff now
AKA: Jackson Gray
FRC #0842 (Falcon Robotics)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Phoenix, AZ
Posts: 72
Maxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura about
Does anyone know someone with extensive knowledge of c#?

We need some help with the emguCV libraries and pointers/handles in c#. If anyone could help us out with either topic, It would be greatly appreciated.
  #2   Spotlight this post!  
Unread 11-12-2013, 21:16
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
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: Does anyone know someone with extensive knowledge of c#?

Never used emguCV, but I have a fair amount of experience with both OpenCV and interfacing with native code in C#.

Do you have a specific question?
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
  #3   Spotlight this post!  
Unread 12-12-2013, 09:28
Maxwell777's Avatar
Maxwell777 Maxwell777 is offline
Is allowed to touch stuff now
AKA: Jackson Gray
FRC #0842 (Falcon Robotics)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Phoenix, AZ
Posts: 72
Maxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura about
Re: Does anyone know someone with extensive knowledge of c#?

Yes, we need help with pointers and handles in c#, which EmguCV uses very often. EmguCV is a .net wrapper for OpenCV.
  #4   Spotlight this post!  
Unread 12-12-2013, 14:19
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
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: Does anyone know someone with extensive knowledge of c#?

That's a very broad topic to talk about in any kind of concrete detail. I'll start with describing the basic concepts, and then maybe you can provide a piece of example code you're having trouble understanding, describe a piece of code you're trying to create, or follow up with a more specific question that I can help you with.

Pointers are, at their simplest, a reference to a location in the computer's memory. Since the variables in a program are each stored at a certain location in memory, pointers are often used to pass references to a variable to other parts of a program [sorta like ref method parameters in C#]. I'm pretty sure the pointers used by emguCV aren't for this purpose, though.

The other main use for pointers (and the way emguCV is using them) is to refer to objects that are created at runtime. For example, when you ask emguCV to create an image of a certain size, it will claim enough memory to store the data for that image. The way emguCV remembers where the image data is stored in memory is by keeping a pointer to it.

When a program claims memory to store an object, it's also responsible for releasing that claim on that memory when it's done with it. If the program doesn't do this, it's called a memory leak, and this is bad. For example, if you create an image each time you process a camera frame, but never release the memory associated with that image when you're done processing that frame, then your program will start using more and more memory over time, since it can't reuse any of that memory when it creates more images for processing new frames.

The reason you don't have to worry about this with C# is that C# uses something called garbage collection, where it automatically keeps track of which objects you're still using and releases an object's memory once your program is done with it.

If you use the CvInvoke class members from emguCV, you're calling directly to the unmanaged functions and you'll get pointers back that you'll have to manage and remember to release manually. However, part of the power of emguCV is that it'll do this memory management automatically, by leveraging C#'s memory management. To use these features, use classes like Image<>.

To talk briefly about handles: handles are another type of reference to an object in memory, but when you call something a "handle," the value of this reference is not necessarily the actual memory address of the object. The value of handle is understood by the code that gave that handle to you, but you shouldn't try to interpret the value yourself. For example, with emguCV, suppose you use the CvInvoke class and get an IntPtr back. You then pass this IntPtr value around your program so that whenever you call another image processing function, emguCV will know which image it's supposed to process. The actual value of the IntPtr means nothing to your program, though, and reading from the memory it points to won't necessarily yield any meaningful data, so these IntPtrs are functioning more like handles. Handles are sometimes called "opaque references" because you can't "see through" the reference to "look at" the actual object.
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
  #5   Spotlight this post!  
Unread 13-12-2013, 09:43
Invictus3593's Avatar
Invictus3593 Invictus3593 is offline
time you like wasting is not wasted
FRC #3593 (Team Invictus)
Team Role: Leadership
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Tulsa, OK
Posts: 318
Invictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really nice
Re: Does anyone know someone with extensive knowledge of c#?

Being mainly a C# programmer my self, I have used EmguCV and had very bad experiences with it throwing all kinds of errors because it didn't wrap OpenCV correctly.
__________________
Per Audacia Ad Astra
  #6   Spotlight this post!  
Unread 13-12-2013, 13:31
Maxwell777's Avatar
Maxwell777 Maxwell777 is offline
Is allowed to touch stuff now
AKA: Jackson Gray
FRC #0842 (Falcon Robotics)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Phoenix, AZ
Posts: 72
Maxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura about
Re: Does anyone know someone with extensive knowledge of c#?

What about syntax? What are the common uses of pointer & handles in emgucv? What are the biggest things I'd need to know about while working with emguCV in c# (like pointers and how they work with some structs and junk)?

Thanks for the advice so far. Work has been going really slowly since we started running into pointers in emgu.
  #7   Spotlight this post!  
Unread 13-12-2013, 13:35
Maxwell777's Avatar
Maxwell777 Maxwell777 is offline
Is allowed to touch stuff now
AKA: Jackson Gray
FRC #0842 (Falcon Robotics)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Phoenix, AZ
Posts: 72
Maxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura about
Re: Does anyone know someone with extensive knowledge of c#?

Quote:
Originally Posted by Invictus3593 View Post
Being mainly a C# programmer my self, I have used EmguCV and had very bad experiences with it throwing all kinds of errors because it didn't wrap OpenCV correctly.
I don't know what's up with your emgu version, but our installation seems to be working just fine. You might have been using an unstable version or something.
  #8   Spotlight this post!  
Unread 13-12-2013, 17:06
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
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: Does anyone know someone with extensive knowledge of c#?

Quote:
Originally Posted by Maxwell777 View Post
What about syntax? What are the common uses of pointer & handles in emgucv? What are the biggest things I'd need to know about while working with emguCV in c# (like pointers and how they work with some structs and junk)?

Thanks for the advice so far. Work has been going really slowly since we started running into pointers in emgu.
While it's possible to use unsafe pointers directly in C# using a similar syntax to that of C, this is generally advised against. Usually pointers are stored as IntPtr-typed values in C# - you can see an example of this here: http://www.emgu.com/wiki/index.php/T...gu.CV.CvInvoke Note that this is a rather low-level interface in emguCV, though, and like I said earlier, you should probably be using the managed classes instead: http://www.emgu.com/wiki/index.php/Working_with_Images

What makes you think you think you need to use pointers with emguCV?
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
  #9   Spotlight this post!  
Unread 16-12-2013, 00:01
Invictus3593's Avatar
Invictus3593 Invictus3593 is offline
time you like wasting is not wasted
FRC #3593 (Team Invictus)
Team Role: Leadership
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Tulsa, OK
Posts: 318
Invictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really nice
Re: Does anyone know someone with extensive knowledge of c#?

Quote:
Originally Posted by Maxwell777 View Post
I don't know what's up with your emgu version, but our installation seems to be working just fine. You might have been using an unstable version or something.
Well I tried about 3 different versions, starting with the most recent and ending with the very first one. I don't know what I could be doing wrong:/
__________________
Per Audacia Ad Astra
  #10   Spotlight this post!  
Unread 16-12-2013, 09:35
Maxwell777's Avatar
Maxwell777 Maxwell777 is offline
Is allowed to touch stuff now
AKA: Jackson Gray
FRC #0842 (Falcon Robotics)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Phoenix, AZ
Posts: 72
Maxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura about
Re: Does anyone know someone with extensive knowledge of c#?

Quote:
Originally Posted by RyanCahoon View Post
While it's possible to use unsafe pointers directly in C# using a similar syntax to that of C, this is generally advised against. Usually pointers are stored as IntPtr-typed values in C# - you can see an example of this here: http://www.emgu.com/wiki/index.php/T...gu.CV.CvInvoke Note that this is a rather low-level interface in emguCV, though, and like I said earlier, you should probably be using the managed classes instead: http://www.emgu.com/wiki/index.php/Working_with_Images

What makes you think you think you need to use pointers with emguCV?
I need to know more about using pointers in emgu because emgu has some methods, specifically optical flow and the PyrLK method, that only accept pointers as parameters. Not to mention knowing how to work pointers would be a good skill to have.
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:06.

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