shading corrector artefacts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

shading corrector artefacts

Martin, Charlotte
Dear List,



I have been using ImageJ for the past few month (not an expert!) to correct images not often processed with such program, i.e. images of painting surfaces captured in macro mode with a compact digital camera.



When I use the 'shading corrector' plugin it generates green pixels in areas presenting particularly bright particles on my corrected image. I don’t understand where this is coming from and how to avoid such artefacts.



Can anyone help?



I’m attaching 3 images (reduced in size): original image, blank-field image and corrected image.




Thanks in advance,



Charlotte





Charlotte Martin de Fonjaudran

PhD Candidate
Conservation of Wall Painting Department
The Courtauld Institute of Art
Somerset House, Strand, London WC2R 0RN
Tel. +44 (0)20 7848 2993

Mob: +44 (0)7 816 289 187
Email: [hidden email]<mailto:[hidden email]>
www.courtauld.ac.uk<http://www.courtauld.ac.uk/>



The Courtauld Institute of Art is a company limited by guarantee (registered in England and Wales, number 04464432) and an exempt charity. SCT Enterprises Limited is a limited company (registered in England and Wales, number 3137515). Their registered offices are at Somerset House, Strand, London WC2R 0RN. The sale of items related to The Courtauld Gallery and its collections is managed by SCT Enterprises Limited, a wholly owned subsidiary of The Courtauld Institute of Art.
This e-mail, including any attachments, is confidential and may be legally privileged. It is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorised dissemination or copying of this e-mail or its attachments and any reliance on or use or disclosure of any information contained in them is strictly prohibited and may be illegal. If you have received this e-mail in error please notify us by return of e-mail [or by telephone +44 (0) 20 7848 1273] and then delete it from your system.

-----------------------------------------------------------------------------------------------------------------------------------------
This email message has been delivered safely and archived online by Mimecast.
For more information please visit http://www.mimecast.com 
-----------------------------------------------------------------------------------------------------------------------------------------

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Trial_0001.tif (109K) Download Attachment
blank-field.tif (109K) Download Attachment
Trial_0001_shad cor.tif (109K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: shading corrector artefacts

Michael Schmid
Hi Charlotte,

it looks like a bug in the 'shading corrector' plugin - it seems that it does not check for overflow.

What you could try is changing the following in the code of public void correctColorShading:

old:
imgR[i] = (byte)(((imgR[i]&255)*(mean/(bgR[i]&255)))+0.5);

new:
int rValue = (int)(((imgR[i]&255)*(mean/(bgR[i]&255)))+0.5);
if (rValue>255) rValue=255;
imgR[i] = (byte)rValue;

and the same for the two other colors, B and G.  The use Compile & Run on the modified plugin.

If this is the reason for the problem, also the correctByteShading and correctShortShading methods should be corrected accordingly (using 0xffff instead of 255 for the 'short' method).

Or maybe someone wants to modify it using the ip.toFloat(i, fp), ip.setPixels(i, fp) and ip.getNChannels() methods (similar to the Blend Images plugin); then the code would be much simpler (I guess that the small increase of processing time would not hurt).

Michael
________________________________________________________________
On Oct 24, 2013, at 12:17, Martin, Charlotte wrote:

> Dear List,
>
>
>
> I have been using ImageJ for the past few month (not an expert!) to correct images not often processed with such program, i.e. images of painting surfaces captured in macro mode with a compact digital camera.
>
>
>
> When I use the 'shading corrector' plugin it generates green pixels in areas presenting particularly bright particles on my corrected image. I don’t understand where this is coming from and how to avoid such artefacts.
>
>
>
> Can anyone help?
>
>
>
> I’m attaching 3 images (reduced in size): original image, blank-field image and corrected image.
>
>
>
>
> Thanks in advance,
>
>
>
> Charlotte
>
>
>
>
>
> Charlotte Martin de Fonjaudran
>
> PhD Candidate
> Conservation of Wall Painting Department
> The Courtauld Institute of Art
> Somerset House, Strand, London WC2R 0RN
> Tel. +44 (0)20 7848 2993
>
> Mob: +44 (0)7 816 289 187
> Email: [hidden email]<mailto:[hidden email]>
> www.courtauld.ac.uk<http://www.courtauld.ac.uk/>
>
>
>
> The Courtauld Institute of Art is a company limited by guarantee (registered in England and Wales, number 04464432) and an exempt charity. SCT Enterprises Limited is a limited company (registered in England and Wales, number 3137515). Their registered offices are at Somerset House, Strand, London WC2R 0RN. The sale of items related to The Courtauld Gallery and its collections is managed by SCT Enterprises Limited, a wholly owned subsidiary of The Courtauld Institute of Art.
> This e-mail, including any attachments, is confidential and may be legally privileged. It is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorised dissemination or copying of this e-mail or its attachments and any reliance on or use or disclosure of any information contained in them is strictly prohibited and may be illegal. If you have received this e-mail in error please notify us by return of e-mail [or by telephone +44 (0) 20 7848 1273] and then delete it from your system.
>
> -----------------------------------------------------------------------------------------------------------------------------------------
> This email message has been delivered safely and archived online by Mimecast.
> For more information please visit http://www.mimecast.com 
> -----------------------------------------------------------------------------------------------------------------------------------------
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html<Trial_0001.tif><blank-field.tif><Trial_0001_shad cor.tif>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: shading corrector artefacts

Martin, Charlotte
Hi Michael,

Thanks a bunch.
Replaced 'old' by 'new' below and no more green pixels!

Cheers,
Charlotte
________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of Michael Schmid [[hidden email]]
Sent: 24 October 2013 13:34
To: [hidden email]
Subject: Re: shading corrector artefacts

Hi Charlotte,

it looks like a bug in the 'shading corrector' plugin - it seems that it does not check for overflow.

What you could try is changing the following in the code of public void correctColorShading:

old:
imgR[i] = (byte)(((imgR[i]&255)*(mean/(bgR[i]&255)))+0.5);

new:
int rValue = (int)(((imgR[i]&255)*(mean/(bgR[i]&255)))+0.5);
if (rValue>255) rValue=255;
imgR[i] = (byte)rValue;

and the same for the two other colors, B and G.  The use Compile & Run on the modified plugin.

If this is the reason for the problem, also the correctByteShading and correctShortShading methods should be corrected accordingly (using 0xffff instead of 255 for the 'short' method).

Or maybe someone wants to modify it using the ip.toFloat(i, fp), ip.setPixels(i, fp) and ip.getNChannels() methods (similar to the Blend Images plugin); then the code would be much simpler (I guess that the small increase of processing time would not hurt).

Michael
________________________________________________________________
On Oct 24, 2013, at 12:17, Martin, Charlotte wrote:

> Dear List,
>
>
>
> I have been using ImageJ for the past few month (not an expert!) to correct images not often processed with such program, i.e. images of painting surfaces captured in macro mode with a compact digital camera.
>
>
>
> When I use the 'shading corrector' plugin it generates green pixels in areas presenting particularly bright particles on my corrected image. I don’t understand where this is coming from and how to avoid such artefacts.
>
>
>
> Can anyone help?
>
>
>
> I’m attaching 3 images (reduced in size): original image, blank-field image and corrected image.
>
>
>
>
> Thanks in advance,
>
>
>
> Charlotte
>
>
>
>
>
> Charlotte Martin de Fonjaudran
>
> PhD Candidate
> Conservation of Wall Painting Department
> The Courtauld Institute of Art
> Somerset House, Strand, London WC2R 0RN
> Tel. +44 (0)20 7848 2993
>
> Mob: +44 (0)7 816 289 187
> Email: [hidden email]<mailto:[hidden email]>
> www.courtauld.ac.uk<http://www.courtauld.ac.uk/>
>
>
>
> The Courtauld Institute of Art is a company limited by guarantee (registered in England and Wales, number 04464432) and an exempt charity. SCT Enterprises Limited is a limited company (registered in England and Wales, number 3137515). Their registered offices are at Somerset House, Strand, London WC2R 0RN. The sale of items related to The Courtauld Gallery and its collections is managed by SCT Enterprises Limited, a wholly owned subsidiary of The Courtauld Institute of Art.
> This e-mail, including any attachments, is confidential and may be legally privileged. It is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorised dissemination or copying of this e-mail or its attachments and any reliance on or use or disclosure of any information contained in them is strictly prohibited and may be illegal. If you have received this e-mail in error please notify us by return of e-mail [or by telephone +44 (0) 20 7848 1273] and then delete it from your system.
>
> -----------------------------------------------------------------------------------------------------------------------------------------
> This email message has been delivered safely and archived online by Mimecast.
> For more information please visit http://www.mimecast.com
> -----------------------------------------------------------------------------------------------------------------------------------------
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html<Trial_0001.tif><blank-field.tif><Trial_0001_shad cor.tif>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

The Courtauld Institute of Art is a company limited by guarantee (registered in England and Wales, number 04464432) and an exempt charity. SCT Enterprises Limited is a limited company (registered in England and Wales, number 3137515). Their registered offices are at Somerset House, Strand, London WC2R 0RN. The sale of items related to The Courtauld Gallery and its collections is managed by SCT Enterprises Limited, a wholly owned subsidiary of The Courtauld Institute of Art.
This e-mail, including any attachments, is confidential and may be legally privileged. It is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorised dissemination or copying of this e-mail or its attachments and any reliance on or use or disclosure of any information contained in them is strictly prohibited and may be illegal. If you have received this e-mail in error please notify us by return of e-mail [or by telephone +44 (0) 20 7848 1273] and then delete it from your system.

-----------------------------------------------------------------------------------------------------------------------------------------
This email message has been delivered safely and archived online by Mimecast.
For more information please visit http://www.mimecast.com 
-----------------------------------------------------------------------------------------------------------------------------------------

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html