Hi,
Trying to help out a friend who's digital camera was playing up on their holiday. Have a bunch of photos that have a coloured vertical line around 5 pixels in width down it. Have experimented with masks and cloning but the camera clearly has some on-board lens correction processing that means the line is slightly curved in the final JPG. No access to a RAW version.
Anyone got any scripts or tips that'll help?
Hopefully the following link will let you download the full size version:
https://www.dropbox.com/s/swc5vlqpgilw3z2/069.JPG?dl=1
Or to view in browser:
https://www.dropbox.com/s/swc5vlqpgilw3z2/069.JPG
Thanks in advance.
Removing vertical line from faulty sensor
-
- Posts: 2
- Joined: 2014-08-12T14:52:09-07:00
- Authentication code: 6789
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Removing vertical line from faulty sensor
If you can isolate the line as a mask, you can process the image with a 1D blur or 2D median filter and then use the mask to composite the two so that the blurred or median image is used to fill in only where the line exists.
Otherwise see any inpainting tool such as http://www.theinpaint.com/, though you probably have to mask again or make the line transparent.
Otherwise see any inpainting tool such as http://www.theinpaint.com/, though you probably have to mask again or make the line transparent.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Removing vertical line from faulty sensor
You might be able to create a good mask by photographing a black card or taking a picture with the lens cap on. Then the processing would be easier as described above.
I tried to get a mask, but it was very hard to isolate the line, especially in the area of clouds.
I tried to get a mask, but it was very hard to isolate the line, especially in the area of clouds.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Removing vertical line from faulty sensor
If all the images have bad pixels in the same place, Fred's suggestion will work well. Make a mask showing the bad pixels, make them transparent, and fill them in eg by blurring.
I fear the bad pixels are a vertical line on the sensor, but on-board processing has shifted this to correct lens geometric distortion. This may vary by focal length, and perhaps also by focus. It might be possible to write a script to automatically find the bad pixels, especially if exif data has recorded the focal length etc.
Failing that, you could use the clone tool in Gimp. This might take a couple of minutes per photo, so might be the quickest method.
I fear the bad pixels are a vertical line on the sensor, but on-board processing has shifted this to correct lens geometric distortion. This may vary by focal length, and perhaps also by focus. It might be possible to write a script to automatically find the bad pixels, especially if exif data has recorded the focal length etc.
Failing that, you could use the clone tool in Gimp. This might take a couple of minutes per photo, so might be the quickest method.
snibgo's IM pages: im.snibgo.com
-
- Posts: 2
- Joined: 2014-08-12T14:52:09-07:00
- Authentication code: 6789
Re: Removing vertical line from faulty sensor
Thanks for all the tips everyone, appreciate it.
On further investigation, you're bang on snipgo - the position changes slightly. Thanks for all the advice though, do appreciate it. By hand it is then!
On further investigation, you're bang on snipgo - the position changes slightly. Thanks for all the advice though, do appreciate it. By hand it is then!
Re: Removing vertical line from faulty sensor
I am not very good with javascript but am working with it on a project and it has made me wonder if you could use it to click on the line in several places and get the co ordinates; you could create an arc. You may be able to make either side of the arc blurred or transparent and then composite the image with the transparency offset by say 10px over a copy of the original image.
Anyway just an idea but might be worth pursuing on a different forum for web developers?
This is the code I am working with and you can see it returns the points clicked.
Anyway just an idea but might be worth pursuing on a different forum for web developers?
This is the code I am working with and you can see it returns the points clicked.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Removing vertical line from faulty sensor
Bonzo has a good point. You can point pick in any tool that will record your points. Store them in a string. Use the string to draw a stroke of white slightly larger than the width of your defect on a black background image so you have a binary (mask) image. Do -morphology edgeout so that you get white pixels on each side of the line. Convert each side of edge points into a list of pairs of points (one coordinate on each side) for every y coordinate in the image, then get the colors for each pair from the image and average them or interpolate them to fill in the space between each coordinate pair.
Alternately, if you have the black and white mask, you can just use a broad 1D average or median (see -statistic) to process the image (make it about twice the width of your defect line. Then use the mask to put the smoothed result over the original only where the mask is white.
Alternately, if you have the black and white mask, you can just use a broad 1D average or median (see -statistic) to process the image (make it about twice the width of your defect line. Then use the mask to put the smoothed result over the original only where the mask is white.