|
let say it the first time i am using C# what is recommended between starting a new page and or continuing with the temp-let form C#?
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Tall joe wrote: let say it the first time i am using C#
Assuming this really is your first time using c# I suggest you google for "c# hello world". Which is a console app.
If you want winforms try this walkthrough[^]
|
|
|
|
|
I would recommend building a few samples from a book.
That is a good way to start writing new applications.
Remember, just don't copy code, try and understand what is happening in the sample code.
|
|
|
|
|
I am using the following code to try to add shortcut to the recent part of start menu (not to the start menu programs) but nothing is happening.
where is the problem?
I am using the following code to try to add shortcut to the recent part of start menu (not to the start menu programs) but nothing is happening.
where is the problem?
WshShell shell = new WshShell();
IWshShortcut MyShortcut;
MyShortcut = (IWshShortcut)shell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Recent) + "\\" + Application.ProductName + ".lnk");
MyShortcut.TargetPath = Application.ExecutablePath;
MyShortcut.Description = "Launch the App!";
MyShortcut.Save();
|
|
|
|
|
Are you sure that your program is running under the same user whose start menu you're looking at?
It's possible that you have Visual Studio running as an admin while you're logged in as a different user, and when you hit "debug," it runs the program as admin.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hello
modified 25-Jul-12 0:50am.
|
|
|
|
|
Akshay_88 wrote: can anyone please help me out? You could try Google, there are lots of options available, not all of which will fulfil your requirements.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Most barcode scanners will provide the decoded barcode for any barcode they support. May be a better option than requiring a camera for your users.
|
|
|
|
|
HI all,
Is there a way to write data(text data) to Linux directory using C#? or Help me with establishing connectivity with Linux using C# code.
Regards,
Yuva
|
|
|
|
|
yuvachandra wrote: Is there a way to write data(text data) to Linux directory using C#?
Works the same as if you were writing to a Windows file.
Will you be writing on the local PC (ie, running C# on that Linux-machine) or from a remote machine?
Simplest way is to install Mono; you can use the usual classes from System.IO to write to the local filesystem. If you're running on Windows and want to write to Linux, easiest way is to have a small app running on the Linux-machine and have the Win-App talk to that over TCP/IP. The cleanest way would be using Samba - if you can install that on the Linux machine, you could map a drive to your Windows host.
So, in short;
- Write local or remote?
- Write from Linux or Windows?
- Is Mono or Samba installed?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
File Transfer Protocol also known as FTP.
The linux box runs a FTP server and the client box runs a FTP client.
|
|
|
|
|
I capture images from a webcam, do some heavy processing on them, and then show the result. To keep the framerate high, i want to have the processing of different frames run in parallel.
So, I have a 'Producer', which captures the images and adds these to the 'inQueue'; also it takes an image from the 'outQueue' and displays it:
public class Producer
{
Capture capture;
Queue<Image<Bgr, Byte>> inQueue;
Queue<Image<Bgr, Byte>> outQueue;
Object lockObject;
Emgu.CV.UI.ImageBox screen;
public int frameCounter = 0;
public Producer(Emgu.CV.UI.ImageBox screen, Capture capture, Queue<Image<Bgr, Byte>> inQueue, Queue<Image<Bgr, Byte>> outQueue, Object lockObject)
{
this.screen = screen;
this.capture = capture;
this.inQueue = inQueue;
this.outQueue = outQueue;
this.lockObject = lockObject;
}
public void produce()
{
while (true)
{
lock (lockObject)
{
inQueue.Enqueue(capture.QueryFrame());
if (inQueue.Count == 1)
{
Monitor.PulseAll(lockObject);
}
if (outQueue.Count > 0)
{
screen.Image = outQueue.Dequeue();
}
}
frameCounter++;
}
}
}
There are different 'Consumers' who take an image from the inQueue, do some processing, and add them to the outQueue:
public class Consumer
{
Queue<Image<Bgr, Byte>> inQueue;
Queue<Image<Bgr, Byte>> outQueue;
Object lockObject;
string name;
Image<Bgr, Byte> image;
public Consumer(Queue<Image<Bgr, Byte>> inQueue, Queue<Image<Bgr, Byte>> outQueue, Object lockObject, string name)
{
this.inQueue = inQueue;
this.outQueue = outQueue;
this.lockObject = lockObject;
this.name = name;
}
public void consume()
{
while (true)
{
lock (lockObject)
{
if (inQueue.Count == 0)
{
Monitor.Wait(lockObject);
continue;
}
image = inQueue.Dequeue();
}
lock (lockObject)
{
outQueue.Enqueue(image);
}
}
}
}
Rest of the important code is this section:
private void Form1_Load(object sender, EventArgs e)
{
Consumer[] c = new Consumer[consumerCount];
Thread[] t = new Thread[consumerCount];
Object lockObj = new object();
Queue<Image<Bgr, Byte>> inQueue = new Queue<Image<Bgr, Byte>>();
Queue<Image<Bgr, Byte>> outQueue = new Queue<Image<Bgr, Byte>>();
p = new Producer(screen1, capture, inQueue, outQueue, lockObj);
for (int i = 0; i < consumerCount; i++)
{
c[i] = new Consumer(inQueue, outQueue, lockObj, "c_" + Convert.ToString(i));
}
for (int i = 0; i < consumerCount; i++)
{
t[i] = new Thread(c[i].consume);
t[i].Start();
}
Thread pt = new Thread(p.produce);
pt.Start();
}
The parallelisation actually works fine, I do get a linear speed increase with each added thread (up to a certain point of course). The problem is that I get artifacts in the output, even if running only one thread. The artifacts look like part of the picture is not in the right place.
Example of the artifact (this is without any processing to keep it clear, but the effect is the same)
Any ideas what causes this?
Thanks
|
|
|
|
|
Hi,
no I don't see it right away, here are some thoughts:
1.
the bad band seems to be an upside-down copy of another band in the same image, about 1 inch below. Not sure how you get things turned upside down.
2.
I'm puzzled by your Image<Bgr, Byte> type. For performance sake, I do hope your image isn't some kind of "list of individual bytes".
3.
I'm also puzzled by your locking mechanism:
a. your lock is taken by the producer almost all of the time (as it spends its time in capture and display); is this your way of enforcing a strict frame locking?
b. I think I would keep both capture and display out of the lock, i.e. only lock the queue operations themselves; and then use different locks for different queues. That would give maximum freedom to the threads. Unless you have reasons not to want that at all.
4.
What is the frequency of the artefacts? is there at most one per frame? is it always the same height? and at/near the same position? Do they occur right away, or does it take quite some time for the first to surface? And are you sure you don't have them in the capture itself?
|
|
|
|
|
Thanks Luc
2. Image<bgr, byte=""> is the image object of EMGU (openCV wrapper).
4. Every frame contains artefacts of about the same height, but their position changes. They are certainly not in the original capture.
I'll try to work on your suggestions related to locking.
Edit: Moving the capture and display out of the lock delivered a much better result! The artifacts still occur, but in only a small amount of frames, and mainly only a small one at the top.
modified 23-Jul-12 9:23am.
|
|
|
|
|
Kangerm00se wrote: only a small amount of frames
OK, that tells me there is a problem that happens statistically, as now your synchronization is reduced. You had a strict lock-step before which forced it to go wrong every time; with more freedom it becomes a gamble each time.
You still haven't found the cause, of course. Changing the locking wasn't supposed to fix it, it was intended to provide more info, and it did. Now I would add logging to file: number the images, provide millisecond timestamps, and log those for all major events (start/end image capture by the hardware, start/end image capture routine, start/end image display, enqueue/dequeue, etc. If possible, add a way to enter a message when an image looks bad too.
Then study the file, watch for abnormal sequences and unexpected delays.
|
|
|
|
|
I don't see anything in here which would cause a problem, if I'm reading the locking correctly. Is the library that you're using re-using memory for different Image objects?
|
|
|
|
|
Hello Everyone, I would like to know the API's that are available for USB-based Barcode scanners in C# and the difference between keyboard interface and the USB interface.Any Suggestions please.
|
|
|
|
|
Umm, I have used USB Bar Code scanners in the past with the relevant driver they appear as com ports (set up the port and go!), the keyboard wedges types tend to use a custom piece of software to get the data out.
Glenn
|
|
|
|
|
OK i will set up the COM ports. But i will have to write a code for the scanned barcode data and for that what are the API's that are available.? I am quite new to this. So i have least knowledge on scanning functionalities?
|
|
|
|
|
OK, with a USB scanner I used all that was needed was to set up the bar code scanner from the documentation, I printed out some pages with the details of Com port, size of bar code, a few things like that, set up the com port and go. What are you trying to do, it just that for USB bar code scanners you shouldn't need to go anywhere near API's. You might have to for wedge scanners however if you hunt around the manufactures website & google there is probably a method that does not use API's.
Glenn
|
|
|
|
|
I will explain my application that I have started working on. I am trying to generate the barcodes,print it and scan it and integrate it with HIS or RIS application? and i did try to go through there product specification info. But dint find much on the API or the technical information of it?
|
|
|
|
|
Ah, OK, I have only ever had to read read pre-generated bar codes using a USB scanner can't really be more help that that.
Glenn
|
|
|
|
|
Oho k not a problem. Anyways thanks.
|
|
|
|
|
Most barcode-scanners that I used came with drivers, and they spit out the barcode as if the numbers where typed by a keyboard.
Which barcode-scanner will you be using?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|