IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
How to demosaic raw Bayer images?
elakdawalla
post Jan 22 2016, 04:24 PM
Post #1


Administrator
****

Group: Admin
Posts: 5164
Joined: 4-August 05
From: Pasadena, CA, USA, Earth
Member No.: 454



There's been discussion elsewhere on the forum about how to demosaic images that come down as raw pixel values from cameras with Bayer filters, but I have not been able to do this myself and am looking for some help. What do you folks recommend to demosaic images? I'm a Windows user...

In this post Damia recommended ImageJ with the Debayer plugin. I downloaded ImageJ (now Fiji) from here and the Debayer plugin from here as well as the PDS Reader plugin from here. Trying the Debayer plugin on a raw MSL image, the following error appeared in the console, and I'm not sure what to do to solve the problem; can anybody help?

QUOTE
Compiling 1 file in C:\Users\Emily\AppData\Local\Temp\java6621339374403543752
C:\Users\Emily\AppData\Local\Temp\java6621339374403543752\src\main\java\Debayer_Image.java:8: cannot access java.lang.Object
bad class file: ZipFileIndexFileObject[D:\CloudStation\Pictures\Fiji.app\java\win64\jdk1.8.0_66\jre\lib\rt.jar(java/lang/Object.class)]
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class Debayer_Image implements PlugInFilter {
^
org.scijava.minimaven.JavaCompiler$CompileError: Compile error: 1
at org.scijava.minimaven.JavaCompiler.call(JavaCompiler.java:105)
at org.scijava.minimaven.MavenProject.build(MavenProject.java:538)
at org.scijava.minimaven.MavenProject.build(MavenProject.java:463)
at org.scijava.minimaven.MavenProject.build(MavenProject.java:446)
at org.scijava.plugins.scripting.java.JavaEngine.compile(JavaEngine.java:211)
at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:135)
at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:173)
at org.scijava.script.ScriptModule.run(ScriptModule.java:173)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:191)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)


--------------------
My blog - @elakdawalla on Twitter - Please support unmannedspaceflight.com by donating here.
Go to the top of the page
 
+Quote Post
Floyd
post Jan 22 2016, 05:06 PM
Post #2


Member
***

Group: Members
Posts: 835
Joined: 4-September 06
From: Boston
Member No.: 1102



C:\Users\Emily\AppData\Local\Temp\java6621339374403543752\src\main\java\Debayer_Image.java:8: cannot access java.lang.Object
bad class file: ZipFileIndexFileObject[D:\CloudStation\Pictures\Fiji.app\java\win64\jdk1.8.0_66\jre\lib\rt.jar(java/lang/Object.class)]
class file has wrong version 52.0, should be 50.0

Looks like the program expects version 50.0 rather than the more recent version 52.0 of java. You may be able to download the older version and put it in the correct folder to make the program happy.... (non-expert advise).


--------------------
Go to the top of the page
 
+Quote Post
charborob
post Jan 22 2016, 05:24 PM
Post #3


Member
***

Group: Members
Posts: 720
Joined: 21-September 07
From: Québec, Canada
Member No.: 3908



Is there a way to do it in PhotoShop (v. CS5, Mac)?
Go to the top of the page
 
+Quote Post
elakdawalla
post Jan 22 2016, 06:08 PM
Post #4


Administrator
****

Group: Admin
Posts: 5164
Joined: 4-August 05
From: Pasadena, CA, USA, Earth
Member No.: 454



I'd like to know the answer to this, too.


--------------------
My blog - @elakdawalla on Twitter - Please support unmannedspaceflight.com by donating here.
Go to the top of the page
 
+Quote Post
Ian R
post Jan 22 2016, 06:47 PM
Post #5


Member
***

Group: Members
Posts: 774
Joined: 18-July 05
From: Plymouth, UK
Member No.: 437



Emily,

The free IRIS package looks like it has a good solution in the form of it's 'Convert a CFA image' command:

http://www.astrosurf.com/buil/iris/tutorial3/doc13_us.htm


--------------------
Go to the top of the page
 
+Quote Post
Ian R
post Jan 22 2016, 06:53 PM
Post #6


Member
***

Group: Members
Posts: 774
Joined: 18-July 05
From: Plymouth, UK
Member No.: 437



http://www.inweb.ch/foto/rawformat.html#debay


--------------------
Go to the top of the page
 
+Quote Post
Gerald
post Jan 22 2016, 07:54 PM
Post #7


Senior Member
****

Group: Members
Posts: 2252
Joined: 7-December 12
Member No.: 6780



To be fully compliant with the MMM cameras, apply the 5x5 kernel as described in the SIS, Appendix D.
This works well only with the lossless PDS EDRs. Lossy compressed JPGs result in a color cast.
Go to the top of the page
 
+Quote Post
elakdawalla
post Jan 22 2016, 10:36 PM
Post #8


Administrator
****

Group: Admin
Posts: 5164
Joined: 4-August 05
From: Pasadena, CA, USA, Earth
Member No.: 454



QUOTE (Ian R @ Jan 22 2016, 10:47 AM) *
Emily,

The free IRIS package looks like it has a good solution in the form of it's 'Convert a CFA image' command:

http://www.astrosurf.com/buil/iris/tutorial3/doc13_us.htm

Hooray, IRIS worked! Thank you!


--------------------
My blog - @elakdawalla on Twitter - Please support unmannedspaceflight.com by donating here.
Go to the top of the page
 
+Quote Post
Ian R
post Jan 23 2016, 08:57 AM
Post #9


Member
***

Group: Members
Posts: 774
Joined: 18-July 05
From: Plymouth, UK
Member No.: 437



Yes! Hadn't tested it myself, so it was somewhat of a stab in the dark ... but I'm glad it worked! cool.gif


--------------------
Go to the top of the page
 
+Quote Post
charborob
post Jan 23 2016, 12:21 PM
Post #10


Member
***

Group: Members
Posts: 720
Joined: 21-September 07
From: Québec, Canada
Member No.: 3908



IRIS works for Windows only. Is there something for Mac users?
Go to the top of the page
 
+Quote Post
JohnVV
post Jan 28 2016, 12:31 AM
Post #11


Member
***

Group: Members
Posts: 844
Joined: 18-November 08
Member No.: 4489



I have been using the G'Mic terminal program
it handles 32 bit float and 16 bit signed and unsigned

there is also a gimp plugin for it
and it works on 16 bit data if you build the plugin with Gimp 2.9.3 DEVELOPMENT

for the jpg's
CODE
gmic 0017ML0000500000100213C00_XXXX.jpg -bayer2rgb 1,1,1 -o 0017ML0000500000100213C00_XXXX.png


for the raw dat file
http://pds-imaging.jpl.nasa.gov/data/msl/M...R/SURFACE/0017/
CODE
dat2img 0017ML0000500000100213C00_XXXX.DAT test

cd test
pds2isis from=0017ML0000500000100213C00_XXXX_00.IMG to=0017ML0000500000100213C00_XXXX_00.cub

cubeatt from=0017ML0000500000100213C00_XXXX_00.cub to=0017ML0000500000100213C00_XXXX_00.raw+BSQ+detached


the dat2img code is here
http://pds-imaging.jpl.nasa.gov/data/msl/M...1/SOFTWARE/SRC/

now i have a raw bayer image
CODE
gmic 0017ML0000500000100213C00_XXXX_00.raw,uchar,1536,1152 -bayer2rgb 1,1,1 -o 0017ML0000500000100213C00_XXXX_00.png


Go to the top of the page
 
+Quote Post
JohnVV
post Jan 28 2016, 01:12 AM
Post #12


Member
***

Group: Members
Posts: 844
Joined: 18-November 08
Member No.: 4489



or for the gimp plugin ( available as a prebuilt MS Windows and Apple plugin )
http://mars.jpl.nasa.gov/msl-raw-images/ms...0000C0_DXXX.jpg

the plugin , and for windows AND Apples Mac
http://gmic.eu/gimp.shtml


open the jpg in gimp

change it from a "gray" to a "RGB"
( image/mode/RGB )

then Filters / Gmic
that opens the plugin GUI
click the "Repair" list in the menu
then select the "Bayer Reconstruction"

the defaults are normally a GOOD start
the msl-raw image above




OR you can use "Krita"
the gmic plugin is ALREADY built into the program
runs on Linux , Apple, Windows

https://krita.org/
https://krita.org/download/krita-desktop/

Go to the top of the page
 
+Quote Post
elakdawalla
post Apr 10 2019, 07:51 PM
Post #13


Administrator
****

Group: Admin
Posts: 5164
Joined: 4-August 05
From: Pasadena, CA, USA, Earth
Member No.: 454



I am just bumping this topic because I had forgotten how to deBayer images and Googled and found this page and yep, IRIS worked for me again! biggrin.gif


--------------------
My blog - @elakdawalla on Twitter - Please support unmannedspaceflight.com by donating here.
Go to the top of the page
 
+Quote Post
Ian R
post Apr 11 2019, 09:45 PM
Post #14


Member
***

Group: Members
Posts: 774
Joined: 18-July 05
From: Plymouth, UK
Member No.: 437



Hey, I'd forgotten about this. Thanks for the reminder, Emily!


--------------------
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 17th October 2019 - 03:42 PM
RULES AND GUIDELINES
Please read the Forum Rules and Guidelines before posting.

IMAGE COPYRIGHT
Images posted on UnmannedSpaceflight.com may be copyrighted. Do not reproduce without permission. Read here for further information on space images and copyright.

OPINIONS AND MODERATION
Opinions expressed on UnmannedSpaceflight.com are those of the individual posters and do not necessarily reflect the opinions of UnmannedSpaceflight.com or The Planetary Society. The all-volunteer UnmannedSpaceflight.com moderation team is wholly independent of The Planetary Society. The Planetary Society has no influence over decisions made by the UnmannedSpaceflight.com moderators.
SUPPORT THE FORUM
Unmannedspaceflight.com is a project of the Planetary Society and is funded by donations from visitors and members. Help keep this forum up and running by contributing here.