create a polarization image

hello everyone :)
i need help to create a pol image for my final project,
the formula is:
pol image = (HH-HV) / (HH+HV)
when HH is the first image (which I used two horizintal polarizers)
and HV is the second image (which I used two vertical polarizes).
In practice I just get a black picture, instead of a sharpened picture as I would like to get using this technique.
I'm a bit involved in implementing this in MATLAB.
I will be very grateful to you soon.
Attached is the code I tried and did not work for:
close all; clear all; clc;
h=imread('ofki.jpg');h=rgb2gray(h);
% v=imread('rohbi.png'); v=rgb2gray(v);
n = imadd(h,v,'uint8');
% m = imabsdiff(h,v);
m = imsubtract(h,v);
z = abs(imdivide(m,n));
imshow(z,[]);

2 comentarios

Walter Roberson
Walter Roberson el 30 de Mayo de 2019
Use im2double so that you are working in floating point.
Your formula can produce negative values. Where H is 0 then you get -1 for any nonzero V value and nan if H and V are both 0.
For H nonzero and V 0 then you get 1.
For H and V nonzero and H<V you get a negative greater than -1
For H and V nonzero and H>V you get a positive less than 1.
Your range is thus -1 to +1 except for some nan. You need to accommodate this in your display such as using imagesc(pol, [-1, 1])
JENNY EKOZ
JENNY EKOZ el 30 de Mayo de 2019
Hey
Thanks for the quick reply!
I can not understand why the values ​​obtained are within this range.
Values ​​should not represent a scale of gray levels?
Can you please attach a sample code snippet?
Thanks in advance,
Jenny

Iniciar sesión para comentar.

Respuestas (1)

JENNY EKOZ
JENNY EKOZ el 30 de Mayo de 2019

0 votos

I also try this code:
close all;
clear all;
clc;
h=imread('ofki.jpg'); % horizontal line
h=rgb2gray(h);
h=im2double(h);
v=imread('rohbi.jpg'); % vertical line
v=rgb2gray(v);
v=im2double(v);
m=h-v;
n=h+v;
z = m.\n;
imagesc(z, [-1, 1]);
And again I got a rather strange picture.
I've included the pictures I've used.
I would really appreciate your help as soon as possible :)
Jenny

5 comentarios

z = m./n;
imagesc(z, [-1 1]);
colormap(gray(256));
JENNY EKOZ
JENNY EKOZ el 30 de Mayo de 2019
hi
so i used this code now:
close all;
clear all;
clc;
h=imread('HH.jpeg');
h=rgb2gray(h);
h=im2double(h);
v=imread('HV.jpeg');
v=rgb2gray(v);
v=im2double(v);
m=h-v;
n=h+v;
z = m./n;
imagesc(z, [-1 1]);
colormap(gray(256));
imshow(z,[]);
on the two images attached.
My goal is to find the circle in the middle, to get a sharper picture.
The problem is that I get a worse picture than the original two.
You have an idea. Maybe what's the problem now?
thanks :)
jenny
Walter Roberson
Walter Roberson el 30 de Mayo de 2019
Editada: Walter Roberson el 30 de Mayo de 2019
I am not sure which circle you are referring to.
When I look at h, I see that in the horizontal center, a little down from the vertical center, there is a poorly defined smooth grey area that could be interpreted as being circle plus some arms, sort of like a spiral galaxy. That area turns out to not be highly polarized and to be pretty much indistinguishable from the surrounding area when examined as polarization.
But I also see that there much stronger overall trend, as if the bottom center of the image were one foci of an elipse-ish shape with the bottom part cut off. In the polarization image it almost looks as if it could be a fingerprint.
That larger arc is more easily distinguished, but I still think you would have a quite difficult time sharpening it.
Are these polarized views of a pupil?
JENNY EKOZ
JENNY EKOZ el 30 de Mayo de 2019
Basically I took two pictures of the aperture (which resembles a pupil).
The first picture was taken when I used a horizontal polarizer located in front of the light source and a horizontal polarizer in front of the camera. This is actually the HH image.
I took the second picture in the same way, when the polarizer in front of the camera is in vertical polarization. This is actually an HV image.
My goal is really to try to get a sharper picture, with a strong contrast, based on the difference in the returns of light.
Such as in the picture that I have attached to this message (the burn skin image).
I think that the code itself is compatible with the formula for creating a polarized image (after I changed it based on your comments), but maybe the problem is that the images are too noisy (I do not really understand about image processing), but I'd love to know if you have any idea how to improve it :)
Lots and lots of thanks in advance,
Jenny
Walter Roberson
Walter Roberson el 30 de Mayo de 2019
I did not see anything in the data that could reasonably be used to create sharp edges.

Iniciar sesión para comentar.

Categorías

Más información sobre Introduction to Installation and Licensing en Centro de ayuda y File Exchange.

Preguntada:

el 30 de Mayo de 2019

Comentada:

el 30 de Mayo de 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by