|
Dude, you really got some nerve to start all that
|
|
|
|
|
You need to wait for your article to be open to everybody. People will rate your article based on its content. Currently the majority of members cannot see your article. You just need to be patient.
|
|
|
|
|
I think that you should let your article speak for itself.
|
|
|
|
|
Hello,
i need to import a win32 (unmanaged) dll in C#, can it be done and what would be the best way to do it?
TY
|
|
|
|
|
Hi,
I don't know about importing a DLL, however you can call unmanaged functions using P/Invoke.
I have been writing this little article[^] on the subject, it isn't finished yet, but it may offer an introduction.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, when do we get it on regular forums?]
|
|
|
|
|
Ref. PInvoke, there's a good wiki available;
pinvoke.net/[^]
Rhys
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it"
They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance."
Terry Pratchett
|
|
|
|
|
it can be done as described in the others answers, but consider it is a lot of writing boring code so really think what you need and what not. Because degrees performance, consider writing a wrapper dll which will do some stuff.
Tip: Strings with StringBuilder and size as parameter
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
which dll you want to use?
Is it system dll or else?
|
|
|
|
|
Hi guys
I am simply trying to profile a sine function I created against Math.Sin(). From checking around using the DataTime.Now structure seems to be the one ppl mention to use. But when I profile and get the Tick values before and after they are the same !! even If I call the function multiple times ? I would be sure that the values would have been updated no !! Is there another source from which to get the system time in milliseconds ?
here is the code anyway ??
Thanks
static void Main(string[] args)
{
Sin mySin = new Sin();
double sinValue = 39 * (Math.PI / 180);
long before = DateTime.Now.Ticks;
double good = Math.Sin(sinValue);
long after = DateTime.Now.Ticks;
long result = after - before;
Console.WriteLine("Sin for {0} = {1}", sinValue, good);
Console.WriteLine("Time taken : {0}", result);
before = DateTime.Now.Ticks;
double bad = mySin.SinFunction(sinValue , 6);
after = DateTime.Now.Ticks;
result = after - before;
Console.WriteLine("MySin for {0} = {1}", sinValue, bad);
Console.WriteLine("Time taken : {0} ", result);
Console.ReadLine();
}
|
|
|
|
|
Why isn't your own sine static?
How about this (untested)
edit: of course you should use the StopWatch class but I'm a bit lazy right now (sorry)
static void Main(string[] args)
{
Sin mySin = new Sin();
double sinValue = 39 * (Math.PI / 180);
long before = DateTime.Now.Ticks;
double good;
for (int i = 0; i < 10000; i++)
good = Math.Sin(sinValue);
long after = DateTime.Now.Ticks;
long result = after - before;
Console.WriteLine("Sin for {0} = {1}", sinValue, good);
Console.WriteLine("Time taken for 10k : {0}", result);
before = DateTime.Now.Ticks;
double bad;
for (int i = 0; i < 10000; i++)
bad = mySin.SinFunction(sinValue , 6);
after = DateTime.Now.Ticks;
result = after - before;
Console.WriteLine("MySin for {0} = {1}", sinValue, bad);
Console.WriteLine("Time taken for 10k : {0} ", result);
Console.ReadLine();
}
|
|
|
|
|
|
Thats it indeed. Wow that link has the calculations investigated in some serious depth.
I'm off for a long read thanks.
|
|
|
|
|
How about System.Diagnostics.Stopwatch ?
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
That did the trick brilliantly, thanks a million Harvey and Harold.
|
|
|
|
|
Your welcome
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
|
I have a bitmap image which contains a single irregular shape that resembles a circle. but not exactly. just looks like a circle. i want to determine if it resembles more of a circle or more of an ellipse. to be precise, i am dealing with a biological cell image. hence, the shape is irregular. the rest of the bitmap has a white background.
can someone pls help me out??
thanks.
Vikram
|
|
|
|
|
Errrm this is very complicated, thje stuff of research projects.
If you are just interested in separating more circular from eliptical cells, one method is to up the contrast on the image until it is black and white. Assuming the Cell edge is still visisble, you can pass the bitmap to a neural network trained to distinguish circles from ellipses. You could look at OCR techniques, as these have a similar problem domain.
You won't get a full answer here as it is just too complicated a question!
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
i have read that this can be done using FFT.. but i have no idea how implement FFT to an image.. any advice on this wud be really helpful. thanks!
|
|
|
|
|
FFT is beyond me for this, I know it can be used to determine the "frequency" and orientation of any stripes in a bitmap.
I suggest you google for this.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
|
Convert your image into 2 colors, one color for edge, one color for non-edge. You can then determine centroids of the resulting polygons. With the centroid measure to any edge and then compare your numbers with the results of the many area formulas available for different shapes. Closest one is a likely match.
|
|
|
|
|
i am sorry but i dont understand what u r trying to say.. pls can u elaborate a little more. thanks
|
|
|
|
|
An alternative, not sure if it fits the question; Draw a square box around it, and stretch the image until one of the edges of the irregular shape hits the box.
The center of the box would be easy to find, and you could take that as the center of the irregular shape. Next, draw lines from the center to the edge of the irregular shape; that would give you a List<Radius> . For a "real" circle, the radius would be half the length of the box.
I think that you'd want the standard deviation, not the mean. Remember that the line-thickness of the irregular shape also has an influence on the outcome, you'd have to experiment a bit to determine the appropriate margins as to what would be called a "circle", and what not.
I are Troll
|
|
|
|
|
Hi Friends
An error "An Invalid IP address was specified" occuring while compiling below code
string Server ="smtp.mymail.com";
IPEndPoint ipe = new IPEndPoint(IPAddress.Parse(Server), 25);
please give a solution to overcome error
thanks in advance
-kk.tvm-
|
|
|
|