Forgot Password
Pentax Camera Forums Home
 

Reply
Show Printable Version Search this Thread
05-29-2015, 01:01 AM   #1
Veteran Member
tomtor's Avatar

Join Date: Apr 2008
Location: Netherlands
Posts: 382
Implementing automatic artifact removal from PS shot in dcraw

I am considering to adapt the dcraw program so that it can convert Pentax k3ii Pixel Shift shots and I would like some feedback on the possibility of removing artifacts caused by subject movement.

The green channel is captured twice, so the idea is to detect motion by comparing the brightness of each matching pixel in these two green exposures. If they differ then the subject has changed and on that location the normal bayer interpolation is used.

Could that work?


Last edited by tomtor; 05-29-2015 at 01:06 AM.
05-29-2015, 02:26 AM   #2
Veteran Member




Join Date: Nov 2006
Location: Norway
Photos: Gallery
Posts: 385
Will this be a Pentax proprietary DNG to linear DNG converter?
05-29-2015, 03:54 AM   #3
Veteran Member
tomtor's Avatar

Join Date: Apr 2008
Location: Netherlands
Posts: 382
Original Poster
QuoteOriginally posted by StigVidar Quote
Will this be a Pentax proprietary DNG to linear DNG converter?
Dcraw converts to 16 bit Tiff.
05-29-2015, 04:15 AM   #4
Senior Member




Join Date: Dec 2013
Posts: 212
This will be too sensitive to noise. Try Lucas-Kanade optical flow methode, that my help to get a vector field of movement.

05-29-2015, 04:27 AM   #5
Veteran Member
tomtor's Avatar

Join Date: Apr 2008
Location: Netherlands
Posts: 382
Original Poster
QuoteOriginally posted by 08amczb Quote
This will be too sensitive to noise. Try Lucas-Kanade optical flow methode, that my help to get a vector field of movement.
Yes, noise is an issue, but my proposal is more simple to implement. Advanced analyses will not be made a part of the standard dcraw code, I'm afraid.

Ofcourse everyone is welcome to write his own smarter code.

I would trigger the movement detection with a threshold, eg when the two green readouts differ by 10%
05-29-2015, 05:23 AM   #6
Pentaxian




Join Date: Apr 2007
Location: Sweden
Posts: 1,932
I wonder if it’s not better to just convert the file without any automatic editing at all. And then let the user take it from there. At least have the option to convert without messing with the data.
05-29-2015, 05:37 AM   #7
Veteran Member




Join Date: Nov 2006
Location: Norway
Photos: Gallery
Posts: 385
Will this be a new branch from dcraw or will it be standard dcraw functionality?
05-29-2015, 06:08 AM   #8
Veteran Member
tomtor's Avatar

Join Date: Apr 2008
Location: Netherlands
Posts: 382
Original Poster
QuoteOriginally posted by Gimbal Quote
I wonder if it’s not better to just convert the file without any automatic editing at all. And then let the user take it from there. At least have the option to convert without messing with the data.
Yep, I will start with a non messing implementation.

---------- Post added 05-29-15 at 03:10 PM ----------

QuoteOriginally posted by StigVidar Quote
Will this be a new branch from dcraw or will it be standard dcraw functionality?
That is not for me to decide.

It depends on the original dcraw author (Dave Coffin) if he is willing to adopt the code for this special Pentax feature.



I could use some help in detecting a PS DNG file.

Is there an exif hint which makes it clear that PS was active?

I could use the filesize (>100megabyte) as a hint, but that is less elegant.


Last edited by tomtor; 05-29-2015 at 06:16 AM.
05-29-2015, 06:55 AM   #9
New Member




Join Date: Feb 2013
Posts: 7
QuoteOriginally posted by tomtor Quote
Yep, I will start with a non messing implementation.

---------- Post added 05-29-15 at 03:10 PM ----------


That is not for me to decide.

It depends on the original dcraw author (Dave Coffin) if he is willing to adopt the code for this special Pentax feature.



I could use some help in detecting a PS DNG file.

Is there an exif hint which makes it clear that PS was active?

I could use the filesize (>100megabyte) as a hint, but that is less elegant.
Dave Coffin has a parse.c program that might be useful, but I don't know if it tries to parse everything or only already known exif and ciff data.
05-29-2015, 07:21 AM   #10
Site Supporter




Join Date: Jan 2010
Location: Michigan
Photos: Gallery
Posts: 2,169
QuoteOriginally posted by tomtor Quote
I could use some help in detecting a PS DNG file.
If somebody with a new camera can send you a non pixelshifted and a similar pixelshifted DNG , they can be compared, for example:
$ exiftool -g -u imgp4006.jpg > K3ps.txt ; exiftool -g -u imgp4004.jpg >K3nops.txt ; diff K3ps.txt K3nops.txt

where -u provides all the unknown tags
05-29-2015, 10:27 AM   #11
Veteran Member
tomtor's Avatar

Join Date: Apr 2008
Location: Netherlands
Posts: 382
Original Poster
QuoteOriginally posted by wombat2go Quote
If somebody with a new camera can send you a non pixelshifted and a similar pixelshifted DNG , they can be compared, for example:
$ exiftool -g -u imgp4006.jpg > K3ps.txt ; exiftool -g -u imgp4004.jpg >K3nops.txt ; diff K3ps.txt K3nops.txt

where -u provides all the unknown tags
I'll just use the number of embedded raw images (4) to detect the PS DNG...
05-31-2015, 02:59 AM - 4 Likes   #12
Veteran Member
tomtor's Avatar

Join Date: Apr 2008
Location: Netherlands
Posts: 382
Original Poster
First implementation

I finished an initial version:

http://www.v7f.eu/public/pentax/dcrawps.c

Example usage:

dcraw -T -4 IMGP0121.DNG

IMGP0121.DNG was posted with other files in this thread:

https://www.pentaxforums.com/forums/172-pentax-k-3/296122-k3ii-pixel-shift-first-test-5.html

By default it wil detect artifacts by unexpected changes in the green channel.
Artifacts are repaired by the bayer interpolation on the first image.

-G sets the threshold, by default 10%. -G 1000 will disable, -G 20 sets the threshold to 20

By specifying -v it will highlight the spot in purple. This can also be usefull if you want to repair manually.

The example file has a moving tick

-- edit --
And a compiled windows version:

http://www.v7f.eu/public/pentax/dcrawps32.exe

Last edited by tomtor; 05-31-2015 at 05:24 AM. Reason: added -4 for 16 bit tiff
05-31-2015, 05:55 PM   #13
Pentaxian
Class A's Avatar

Join Date: Aug 2008
Location: Wellington, New Zealand
Posts: 9,177
QuoteOriginally posted by tomtor Quote
I finished an initial version.
That's great stuff, thanks a lot for sharing!

Really cool idea to use the green channel to detect motion.
Reply

Bookmarks
  • Submit Thread to Facebook Facebook
  • Submit Thread to Twitter Twitter
  • Submit Thread to Digg Digg
Tags - Make this thread easier to find by adding keywords to it!
artifact, artifact removal, dcraw, dslr, k-3, k3, k3ii, pentax k-3, pixel, ps, raw, removal from ps, shift, shots, subject
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removal of lens from K2000 Dewman Troubleshooting and Beginner Help 12 06-12-2014 04:44 PM
Dust removal from lens bassek Pentax SLR Lens Discussion 9 08-02-2013 02:33 AM
From PSE to PS CS5 kitkat Troubleshooting and Beginner Help 2 05-24-2011 11:06 AM
From PS Elements 5 to 7 questions OrenMc Digital Processing, Software, and Printing 11 04-12-2009 06:08 AM
Got PS CS2; wanta try PS CS3 Beta? jfdavis58 Photographic Technique 3 12-15-2006 09:42 PM



All times are GMT -7. The time now is 10:07 AM. | See also: NikonForums.com, CanonForums.com part of our network of photo forums!
  • Red (Default)
  • Green
  • Gray
  • Dark
  • Dark Yellow
  • Dark Blue
  • Old Red
  • Old Green
  • Old Gray
  • Dial-Up Style
Hello! It's great to see you back on the forum! Have you considered joining the community?
register
Creating a FREE ACCOUNT takes under a minute, removes ads, and lets you post! [Dismiss]
Top