PixInsight Forum (historical)

PixInsight => Announcements => Topic started by: Carlos Milovic on 2009 September 15 10:27:22

Title: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 15 10:27:22
Hi everybody

Here is a new release, this time a process I called Sharpen. Why? Because it is an implementation of one of the most simplest version of a sharpen algorithm... well, not that simple in this case :D A long time ago I was wondering if a laplacian sharpening filter (using the second derivative) may be used at larger scales, not just as a simple difference between neighbor pixels. So, here is the result, a scale variable algorithm. You may choose between 4 filters, Laplacian4, Laplacian8, WeightedLaplacian8 and LaplaceOfGaussian. The first 3 are straightforward: just decide how many pixels are defined as neighborhood, and how their influence is calculated. The last algorithm is a bit different, first a gaussian blur is applied, with the defined radius as standard deviation, and then a simple laplacian filter is applied too.

Additionally, you may adjust the amount (strength), set a threshold, deringing... and modify the dynamic range.


Here is the Win32 compilation:
http://pteam.pixinsight.com/carlos/modules/Sharpen-pxm.zip

Source code (this module may include a real time preview option, but everything related has been disabled there):
http://pteam.pixinsight.com/carlos/modules/Sharpen-src-2009-09-25.zip


I hope you like it :) Have fun trying the results with different values for the radius.
Title: Re: [Unofficial] New Module: Sharpen
Post by: Nocturnal on 2009 September 15 10:36:07
Well well, you've been busy Carlos! Looks like I need to put my coding hat back on and finish the profile tool :)

Many thanks!
Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 15 10:49:06
Thanks Sander :)

Yes, quite busy... and boring week with economics ans chemistry tests, and a flu :)


What does your profile tool so? Just asking to avoid doing the same thing :D
Btw., I'm starting a tool that plots the intensity of pixels v/s a spatial coordinate (row, column, any line, or a radius)
Title: Re: [Unofficial] New Module: Sharpen
Post by: Nocturnal on 2009 September 15 10:53:58
Hi Carlos,

it was announced here:

http://pixinsight.com/forum/index.php?topic=1308.0

but I need to recompile it for the latest PCL. You draw a line on an image and the tool plots RGB, R, G, B, Lum or Sat. There's also an export to .csv function but that needs some work. Sounds like it may be similar to what you have in mind except yours has more options for how to draw the line?
Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 15 10:59:17
Yes, sounds very similar :P  already wrote a lot of the code one or two years ago, and left unfinished... Let me finish it, see what you have, and start a combined project we two ;)
Title: Re: [Unofficial] New Module: Sharpen
Post by: Nocturnal on 2009 September 15 11:35:29
Hi Carlos,

sure, that might be possible. As we both already have code written it may be our approaches are very different so it may not be possible to merge. We can certainly help each other make progress though. Let me get the module recompiled so you can give it a try. It'll be an opportunity to try Juan's new makefile generator and see if it can create 32bit binaries on a 64bit system.
Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 15 12:50:15
I did not remember how old, and complex the code was :P It will take me a while to update the code to the current PCL, and understand what I wrote :D (now I'm fighting against the parameters... next, interface, the old foe :D )
Title: Re: [Unofficial] New Module: Sharpen
Post by: Nocturnal on 2009 September 15 12:53:01
Just making the module work isn't so hard but to tie everything together so the process can be saved in the image history and as a process icon etc., well, that's enough to make a grown man cry :)
Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 15 12:57:42
Aren't those side-effects of making it work? :D
Title: Re: [Unofficial] New Module: Sharpen
Post by: Harry page on 2009 September 15 14:25:05
Hi Carlos

Sorry I am a dumbo but how do you install this module and I presume its a 32 bit only job  ;)

Regards Harry
Title: Re: [Unofficial] New Module: Sharpen
Post by: Nocturnal on 2009 September 15 15:21:01

Hi Harry,

- uncompress it somewhere
- use the process->modules->install module dialog
Title: Re: [Unofficial] New Module: Sharpen
Post by: Harry page on 2009 September 16 12:35:40
Hi

Thanks for the info now got it loaded   :D

Also many thanks for this Carlos , works great and is a great addition to pixinsight as If we are to totally wean ourselves of photoshop we need relatively simple tools like this one, as well as the complex ( all be it probably more powerful ) Modules.

Any chance of a 64 bit version   ;)

Regards Harry
Title: Re: [Unofficial] New Module: Sharpen
Post by: Nocturnal on 2009 September 16 13:22:50
Hi Harry,

you *could* install PCL64 and Visual Studio Express 2008 (free) and compile it yourself :)

Or you can wait till I get around to doing it. I meant to do so last night but didn't.
Title: Re: [Unofficial] New Module: Sharpen
Post by: Harry page on 2009 September 16 13:26:33
Hi

I have tried your filter and find the 4 version works fine , but the 8 filters crash with a memory violation  :'(

What do you think

Harry
Title: Re: [Unofficial] New Module: Sharpen
Post by: C. Sonnenstein on 2009 September 16 14:43:20
Hi Carlos!

This tool is very exciting, and very useful for flatten star masks. Congratulations.
Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 16 18:25:45
Hmmm... I though that I fixed the 8 ways filters :P I was receiving a memory violation when a non integer radius was set. Was this the case? (maybe I uploaded an earlier compilation).


Thanks Carlos for your words :)


Harry, if you have any suggestion on simple processes that are worth implementing, just say so, and I'll add it to my To-do list. I like these simple tools, because I'm a bit rusty and need some previous "exercises" to get into my "programing shape" :D


 
BTW, I don't have a W94 computer... so I cannot help there... I'm counting on Juan's aid here ;)
Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 17 05:35:23
Ok. I got the same message now, with any radius. Hmmmmmmmmmmm. Back to the debugger table :P
Title: Re: [Unofficial] New Module: Sharpen
Post by: Nocturnal on 2009 September 17 07:05:58
Hi,

I compiled the Sharpen module for x64:

http://www.tungstentech.com/files/Sharpen-pxm-win64.zip
Title: Re: [Unofficial] New Module: Sharpen
Post by: Harry page on 2009 September 17 13:13:19
Hi Sander

Many thanks for your skilled work, but I am afraid its still bugged >:D

Regards Harry
Title: Re: [Unofficial] New Module: Sharpen
Post by: Nocturnal on 2009 September 17 13:18:50
Luckily I did not attempt to fix any bugs. I just recompiled :)
Title: Re: [Unofficial] New Module: Sharpen
Post by: Harry page on 2009 September 17 13:21:40
Hi Carlos

I would like a heal tool !  great for zapping hot pixels, I know there is a clone tool , but a heal tool ( Sorry photoshop talk ) gives a seamless fix  O:)

And how about a dust bunny eradicator  ( This might be hard )

Also there was a hint but real time view of the sharpen tool

And ...........   no I will stop there as I will drive you mad


Harry
Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 17 23:28:52
I gave the code a quick look, but did not find that little $!"ยท$ bug :D I fear that I'll have a "nice" day ahead tomorrow, polishing my hunting skills :D


Harry, I'm thinking about that heal tool. I guess that it should not be that hard, working over the clone stamp code (although it is quite complex for me). Perhaps a simple statistical analysis may do the work, like I do in ABE's inner rejection algorithm. Another option is just a simple threshold. My problem is that either way the stars have small chances to survive, so I want to sophisticate that a bit.
What is a dust bunny? The artifact created by dust over the sensor? Sounds interesting... Maybe a FFT approach... :)
About RT, this kind of objects fly more than a pair of meters above my head :D I'll need Juan's help there.

Well, let's see what happens this weekend... :)

Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 18 10:08:05
I think I cornered him... at least, how to reproduce the error, and where it is NOT on the code :D The error appear only when working with floating points images, with the Laplace8 and WeightedLaplace8 algorithm. The answer seems straightforward then, but all algorithms share the same way of handling image bit depth, what is done at the beggining. So, I'm not sure of the reason of this strange behavior. I noticed no problems at all with integer samples...
Also there is something else that is annoying me. If there is no error message, the output is not always the same. I got some "hot" pixels (or even lines), randomly.

Juan, could you give me a hand here?
Title: Re: [Unofficial] New Module: Sharpen
Post by: Juan Conejero on 2009 September 18 10:46:34
Hi Carlos,

Sure thing. However I ask for a bit of patience since right now I am involved in a huge mess - I am switching from VMware to VirtualBox, and this means I have to rebuild all Windows virtual machines. PixInsight's build system is "under construction" right now on all platforms 8) (non-developer users: the situation is under control -- reasonably ;D)
Title: Re: [Unofficial] New Module: Sharpen
Post by: Juan Conejero on 2009 September 18 10:49:01
Carlos, one more thing. Could you please upload your source code as a .zip archive? Currently tar is something too exotic for my Linux box  :cheesy:
Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 18 10:54:04
Ok. Let me finish some changes I'm doing to GaussianBlur (more parameters and a control window drawing the filter), and I'll upload both modules/codes. Sharpen has some minor changes too, mainly small optimizations of the code.
Title: Re: [Unofficial] New Module: Sharpen
Post by: Harry page on 2009 September 18 11:29:38
Hi Carlos

Looks like you are having fun   >:D

You are right a dust Bunnie is the shadow from a bit of muck,

I think there are two way of looking at this ,  try and model the mote and correct it, this would be very advanced and perhaps to much to ask or just look the motes in background areas and fix them with a fancy heal tool
Of course you may have many better ideas

Good luck with the hunt  ;D

Harry
Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 18 11:51:55
Hi Harry

Yes, I'm thinking on a way to modelate them, automatically. Since it is a multiplicative effect, and with a somehow predictable shape (well, we know that it is very simetrical, and that is a "negative" effect. I've got two candidates to explore: fourier transform and homomorphic transform. Don't expect a quick answer, anyway :) First I want to finish/update other older modules I wrote but were not released.
Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 18 12:49:54
Juan (and anybody who wants to join the safari) , I just uploaded the last source code, compressed with zip format:

http://pteam.pixinsight.com/carlos/modules/Sharpen-src-2009-09-18.zip


Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 22 05:11:21
Hi all

I've updated the links above with the last release. Thanks to Juan's suggestions, I made it much more faster and robust, and it seems that the annoying bug is gone.
Title: Re: [Unofficial] New Module: Sharpen
Post by: twade on 2009 September 22 10:34:54
Harry,

Quote
a dust Bunnie is the shadow from a bit of muck

If you are working in the digital age, a FLAT will easily remove all the dark shadows caused by dust and/or lint on your imager.  The key is taking a set of FLATs right after you complete your light frames.  In addition, you must create FLATs for each filter taken during the night.  I hope this helps in the interim.

Wade
Title: Re: [Unofficial] New Module: Sharpen
Post by: Harry page on 2009 September 22 11:33:16
Hi Carlos

Will download latsest  and have a go , many thanks for your hard work , All I need is a kind man to do a 64 bit version   O:)


Regards Harry

Title: Re: [Unofficial] New Module: Sharpen
Post by: Harry page on 2009 September 22 11:41:07
Hi Wade

Yep the 21 century has just made the Uk  >:D 

I only use flats if I really have to because they do add noise  ( yes they do , you know they do  :'( )

And when I must use flats they do remove most if not all the motes, but sometimes One gets away  I think this down to my open tubed newt where some

times the appear or disappear and a tool would be handy to get that one that got away  ;D

Many Thanks for your input

Harry
Title: Re: [Unofficial] New Module: Sharpen
Post by: Carlos Milovic on 2009 September 24 22:38:02
Hi guys, just to inform that I found a little bug, and fixed it. W32 compilation and source code links updated.