VNG Debayer

pauljv

Member
As I have limited imaging equipment( a DSLR and fixed tripod), I am concentrating on the preprocessing of the images that I can get, until I get some decent kit.  I couldn't find a VNG debayer so I wrote a script for a Canon EOS500D.  I would say the results are encouraging as when I integrate the images MRS noise evaluation is calculated rather than estimated( not that I have a clue what that means as yet), also the hot pixels are disregarded for all other pixels in there neighbourhood.
Unfortunately it takes minutes to debayer one 15Mpixel image.  I would like to run it in four or more threads, to at least get my processor working at 100%, is this supported in PJSR?  I know from some of the Java I have learnt with the Open University that threading is supported in Java.
Thank you to all those who have made code available to allow a novice to cobble something together in a few days, particularly the helpful comments in Niall's code.

Regards Paul
 
Hi Paul,

Welcome to PixInsight Forum and to PixInsight development.

The PixInsight JavaScript Runtime (PJSR) doesn't support threads. However, I am planning a new feature (native code compiled and executed in real time) that will allow you to implement critical portions of your scripts as native C++ code, which allows parallel execution through threads.

However, by far the best option when you have to implement performance-critical routines is the PixInsight Class Library (PCL). PCL is an ISO C++ development framework that fully supports multiple threads and parallel implementations. PCL is freely available as specific distributions for all supported platforms.

Remember that we are here to help you. Welcome aboard!
 
I've now downloaded Visual C++ 2010, the language is very similar to Java so I should be able to put something together.
All I need now is to get the Pixinsight class library, which I can't find anywhere in the PCL folder, any clues?
I'm using Vista 32 bit.

Regards Paul
 
Hi Paul

I recomment you to download the VC2008. The projects of the 2010 release are not compatible with the Makefile Generator script. If you are using the Express edition, take a look at the forum thread where it is explained how to get the 64bits compiler to work.
 
Sorry, I missed that you are working on Vista 32. Then, MSVC2008 Express should work fine out of the work, with the generated projects.

To have the PCL you have to download it from the distribution system. The "full package" (PCL + Core) is located at the bottom, for every OS.
 
I must have downloaded the wrong version, and since I am still on the trial license ( waiting for pay day for the full licence). I don't have access at the moment to get the library.  I've now decided to do all the coding, using the PCL reference documentation and worry about the compiling later.  If I use the PCL will it work on any machine?

My basic idea is to create a debayer using the information gained from http://scien.stanford.edu/pages/labsite/1999/psych221/projects/99/tingchen/algodep/vargra.html to debayer an image before image registration, then butcher the image registration module, to rebayer the image before it is adjusted.  During image integration only the information that the camera captured will then be integrated not the approximated pixels.  I am not sure whether this is a good idea but at the worst I'll have learned a new language.

Regards Paul
 
Hi,

Juan will have to comment on this but it seems PCL is only available for licensed users. Once you're licensed there is no additional cost though. Keep us posted on the VNG coding. I've been contemplating adding VNG and AHD to the existing debayer module but if you're going to add it then I don't have to :)
 
I will get the full license shortly, and I'm going to have a try at the VNG debayer as the results are quite good but using JSPR it runs too slowly. This could be a steep learning curve, and could take a couple of weeks.  If you are intending to do something within this time-scale don't let me put you off.  I've got a holiday coming up in Nov/Dec with a new moon in the middle so hopefully I'll get some decent images to work with.  Since it is so easy to do everything in PI, and you can write your own modules, it would be nice to optimise it for a DSLR.

If I have encroached on an area that you are working on please accept my apologies as the debayer you produced is obviously a must for any DSLR users.

Regards Paul
 
Hi,

I'm not sure why you think VNG debayer is a must for DSLR users. Why wouldn't bilinear work for that? I realize VNG is more advanced than bilinear but I wouldn't go so far as to call it a requirement.

Don't worry about encroaching on 'my module'. I'd be thrilled if you wrote a VNG debayer module.
 
It must have been the way I wrote it, I meant the module you wrote was a must for a DSLR user.

Regards Paul
 
I have now managed to debayer an image using PCL in 5.7 seconds, down from 6.5 minutes using PJSR.  All I have done is to add code to the SandBoxEngine apply function, and commented out the types I could not debayer in the ExecuteOn function.  The routine will only debayer 32 bit images with an RGGB pattern, with an even number of rows and columns and it makes no assumptions that the source is a monochrome image.  The GUI is the default sandbox one, but using the apply button does the trick.

I have now run out of time to make it more useful, but if anyone would like the source code to improve it I will send it to anybody interested.  It may also be useful to someone just starting out with PCL.  The code is very basic, as I have no previous experience with C or C++, in fact this was the first program that I was able to compile.  I am unsure as to whether the algorithm is exactly the same one I used in the PJSR routine, as the output looks slightly different.  Unfortunately the other routine went when the trial version of PI went.

If there is sufficient interest when I get time I will write up a complete idiots guide to getting started with PCL, authored by a complete idiot.  It probably took me ten times as long to be in a position to write any code, than writing the code itself.

Regards Paul
 
If there is sufficient interest when I get time I will write up a complete idiots guide to getting started with PCL

That's exactly what I am after - consider yourself 'in charge' of one patiently waiting idiot :cheesy:
 
When I apply the debayer to an image, when closing the original, I get the "The image has been modified and is unsaved" message.
Could anyone inform me as how I can overcome this please, as the original has not been modified in any way.

Regards Paul
 
Thankyou, I didn't have an IsHistoryUpdater function in instance but I copied and pasted from the Image calibration module and it did the trick.
I've now got it compiled in Windows 32 and 64 bit, it will now debayer any supported sample type, just the other patterns to add.

Cheers
Paul
 
Back
Top