Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to destroy the shadows from the image.I found an algorithm that is called linear shading algorithm but I am not good at applying the formulas to the code and I have difficulty in implementing it to the code.
Here is the explanation of the algorithm(Next part is quote):

"In this technique, we take two imagesThe first one, r1,
of a thin plate, and the second one, r2, of a thick plate. We define i1 and i2 as the ideal gray values for the first and second image, respectively. From r1, r2, i1 and i2, offset and gain, correction matrices a, and b are calculated assuming a linear transformation between the original X-ray image x and corrected X-ray image y:
Y (i, j) = a(i, j) · X(i, j) + b(i, j)

where the offset and gain matrices are computed as follows:

a(i,j)=(i2-i1)/(r2(i,j)-r1(i,j))

b(i,j)=i1-r1(i,j)*a(i,j)"

How can I implement it to the code?If someone who have the code for this algorithm or is related with image processing could help me I would be appreciate it.

What I have tried:

I could not write a code for this algorithm.
Posted
Comments
[no name] 18-Apr-22 11:08am    
You'll need to read both images into memory and define the values for "i1" and "i2" before you can proceed. Then it's a matter of iterating over the image pixel arrays.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900