|
I have not so far, but I'll give it a try... But still, I would prefer any working example programmed in some .Net language or in native C / C++.
Thanks...
|
|
|
|
|
I'm not sure here, but isn't it more typical to either convolve with a kernel in 'normal' (image) space?
A convolution is rather easy to program, so I'm guessing you could readily program a fast implementation yourself.
Just know that C# (and any .NET language for that matter) isn't known for its speed. If you really want the most out of your program, you could try at C++ or another machine-compiled language.
|
|
|
|
|
I am using native C++ to rewrite working stuff, but for testing I use C#. With GDI+ it is nice that BitmapData is same structure in .Net and native GDI+, so it is easy to migrate working code from C# to native C++.
Simple convolution is what I have done already, but it is too slow (even wrote in C++) compared to PhotoShop plugins, so I am searching for FFT transform of tiles...
Thanks...
|
|
|
|
|
|
Well, Andrew Kirillov has in his library FFT filter, but in convolution filters he does not use them and I need exactly that. Also Christion has made good stuff for beginners, but my question is little more about advanced image processing than about beginner tutorial.
|
|
|
|
|
|
Yes, for most part are, but exactly that part, where they are not is in my interest. What I need is to understand how to forward transform image and mask, multiply them together and transform result back to 'normal' image. I have made some algorithms, but on borders of tiles I have some errors, so I am interested in any code to look for inspiration...
modified on Monday, August 29, 2011 3:29 PM
|
|
|
|
|
if your kernels are separable, you can do the operation as a pair of 1-D convolutions (once in X, once in Y). that will change your complexity from N^2 to N.
|
|
|
|
|
Some kernels are not separable, some are separable. I would like to make it using FFT, but do not know how...
|
|
|
|
|
|
This is exactly what I am looking for. I have it implemented, but there is probably any error in my coding, becouse on borders of result image I have processed pixels from opposite sides of tiles.
Do you know about any code that is doing that correctly?
Or is it normal? Must be used overlapping of input tiles?
Thanks
|
|
|
|
|
sorry, i don't know of any code that does this.
but, that document spends a lot of time talking about how to arrange your kernel to handle the wrap-around problem.
|
|
|
|
|
HI all,
I've written an app that tries to have the main thread sleep while one or more (usually 2) threads idle in the background, each one waking up every X number of minutes to do a data transfer.
For some reason the Private bytes of the app are rising in small but constant increments each time each thread wakes up, and I can't see what I can do to make sure there's nothing hanging around in memory so that I can leave the programme unattended.
(I need to leave this program running on a live server for a long period, so proper use of disposal is really important.)
Main()
{
LaunchThreads(syncNodes);
}
static void LaunchThreads(XmlNodeList syncThreads)
{
foreach (XmlNode threadSetting in syncThreads)
{
Sync syncThread = new Sync(threadSettings);
Thread t = new Thread(new ThreadStart(syncThread.Start));
t.Start();
}
}
}
public class Sync
{
private XmlElement settings;
private int period;
public Boolean interrupt
public Sync(XmlElement syncSettings)
{
settings = syncSettings;
interrupt = false;
period = Convert.ToInt16(settings.GetAttribute("period").ToString())*60000;
}
public void Start()
{
while(!interrupt)
{
Execute();
Thread.Sleep(period);
}
}
private void Execute()
{
}
}
modified on Thursday, September 1, 2011 11:05 AM
|
|
|
|
|
c4tchm4tt wrote: For some reason the Private bytes of the app are rising in small but constant increments each time each thread wakes up, and I can't see what I can do to make sure there's nothing hanging around in memory so that I can leave the programme unattended.
Well, .NET does use a non-deterministic garbage collector.
The garbage collector in .NET prefers to do garbage collection rounds as they are needed. This is a good basic read on it: http://msdn.microsoft.com/en-us/library/0xy59wtx.aspx[^]
If you want to test if you are truly leaking, try this: sleep your main thread for a certain amount of time (rather than -1 now), after which the private bytes have gone up quite a bit. Then issue a GC.Collect() and sleep again. See if that works.
|
|
|
|
|
Hm, well tried that and didn't see any change, besides GC doesn't pop up after unmanaged memory which this would be wouldn't it?
|
|
|
|
|
What makes you think the memory is unmanaged?
At any rate, you are sure the GC call didn't help? So you first let the threads wake up a couple of times, building up private bytes, and then you did a GC collect? And that didn't reduce the memory usage? It's quite hard to 'leak' memory in a .NET application.
Are you allocating any unmanaged memory, or calling unmanaged functions and/or keeping handles, etc.?
The worst case for a full managed application is that you are creating a lot of objects and are keeping all the references, meaning the GC can't collect.
Please describe why you believe there seems to be a memory problem, other than private bytes increasing (which is pretty normal). See http://stackoverflow.com/questions/1984186/what-is-private-bytes-virtual-bytes-working-set[^] for instance, the first (highest ranked) answer.
|
|
|
|
|
Unrelated, but... maybe you want a Windows Service?
|
|
|
|
|
Yeh, a windows service is what ti wil become but I wanted to get a hang of threading and memory management before I ran chasing after service bugs!
I looked at the service template (provided on this site) which looks great but a background worker thread which I understand I would use I think eneds more or less demands the same kind of approach to the above code, so I'm predicting I'd still end up with a memory issue, what do you think?
|
|
|
|
|
c4tchm4tt wrote: I'd still end up with a memory issue
You might, but neither technique seems more prone.
c4tchm4tt wrote: a background worker thread
Some people use those, but I choose to use a System.Timers.Timer for my Windows Services.
|
|
|
|
|
how can make master page in C# window application form...?
|
|
|
|
|
Check this [^]
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
www.cacttus.com
|
|
|
|
|
What do you think a "master page" is ?
best, Bill
"In the River of Delights, Panic has not failed me." Jorge Luis Borges
|
|
|
|
|
Do you mean a MDI container?
|
|
|
|
|
There is no concept of master pages in Windows Forms.
Searching on the internet may provide you with some workarounds.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
May be a "inherited form" will help you(I guess so)
|
|
|
|