Page 1 of 1

map bright r and b pixels and negate rest of image?

Posted: 2016-06-11T05:44:19-07:00
by geoland

Code: Select all

convert rose: -colorspace rgb -colors 256 -depth 8 -format "%c" histogram:info:

color="( *137, *168, *119)"
convert rose: -colorspace rgb -colors 256 -depth 8 txt: | \
grep "$color" | cut -d: -f1
http://www.imagemagick.org/Usage/color_basics/#zeroing

I gleaned the code above from fwm42 Fred's site with a view to modifying a tiff image by zeroing all but the very bright blue and red pixels. This would be used to subtract matching pixels from other images from the same camera, without subtracting any other features.

Having identified the blue and red values to be retained the rest of the image would be negated, including the alpha channel.

Is this doable in IM? If so it will make a very useful template or map of hot and cold pixels. Not sure where to start?

Re: map bright r and b pixels and negate rest of image?

Posted: 2016-06-11T05:55:36-07:00
by snibgo
Your commands are a little strange. The first has no output, and the last pipes to nowhere.
geoland wrote:Is this doable in IM?
Certainly. From a map of known "hot" pixels, you could turn those pixels transparent then use a hole-filling technique to fill them.

Re: map bright r and b pixels and negate rest of image?

Posted: 2016-06-12T02:06:19-07:00
by geoland
Not sure what happened there. Corrected in post.

Re: map bright r and b pixels and negate rest of image?

Posted: 2016-06-12T04:23:43-07:00
by Bonzo
I wrote some code to remove hot pixels from a photo and changed the hot pixel ( plus surrounding ones ) to transparent I then composited it over a blurred version of the same image. This worked well but obviously you need to do it before the image is cropped or resized and you would need a map for all the possible orientations. In the end I did it manually in a photo editing program as my hot pixels only showed up at certain ISO/exposure values.

It is interesting if you take a long exposure with the lens cap on there is a great variation in the pixel colours. I suppose it is impossible to get every pixel to be exactly the same.

Re: map bright r and b pixels and negate rest of image?

Posted: 2016-06-12T05:29:47-07:00
by geoland
I'm not sure how to tackle this but the operation will be on the final image and orientation will not be an issue.

The colour and intensity of the offending pixels is significantly brighter than the remainder of the image. If the hot pixels are mapped and averaged to the surrounding pixels using interpolation / morphology, a disk of some sort, loosely speaking, that might work. http://www.imagemagick.org/Usage/morphology

The process needs to be reasonably quick. In Linux jpeghotp quickly maps hot pixels and jpegpixi fixes them. Something similar for tiff images would be very handy. I will have a look at the code and see if it can work with tiff files.