mirror image and shear image transformation

Sir, In my project, original image is transformed in to mirror image and shear image transformation. After transformation, I need to know which parameters help to simulate these three normal image, mirror image and shear image transformation. If normal image displayed, I need to know this is original image. If it is mirror image displayed, i need to guess it is mirror image, which parameters tells us that it is mirror image or shear image or original image similarly for shear image. Please, help me sir, I need to know the difference and identification of these three types of images. Please help me..

 Réponse acceptée

Image Analyst
Image Analyst le 4 Déc 2017
fliplr() might be useful.
if isequal(originalImage, fliplr(testImage))
% It's a mirror image
end

5 commentaires

Maruthi Maruthi
Maruthi Maruthi le 4 Déc 2017
Modifié(e) : Maruthi Maruthi le 4 Déc 2017
Sir, I tested showing not equal. how to know whether the displayed image in the grid is original image or mirrored or shear transformation. I checked correlation also it showing different results. Please help me sir. How I do in neural networks. for each type of image(normal, mirror, shift) there is a different output. I also need which neural network solves this kind of problem. Please send me the reply as early as possible. Please sir.
Wow. Truly bizarre. This works for me.
% Read in standard MATLAB demo image.
rgbImage = imread('peppers.png');
subplot(2, 1, 1);
imshow(rgbImage);
% Make mirror image of it.
testImage = fliplr(rgbImage);
subplot(2, 1, 2);
imshow(testImage);
if isequal(rgbImage, fliplr(testImage))
% It's a mirror image
message = sprintf('Test image is a mirror image of the original')
else
% It's NOT a mirror image
message = sprintf('Test image is NOT a mirror image of the original')
end
uiwait(helpdlg(message));
Tell me what you see. You're saying it will show you that it's not a mirror image. In that case you should call the Mathworks to report the bug. Also post your original and test images back here so I can see why the perfect mirror image is not equal to the original once it's been flipped.
Sir, Thanks for your earlier response. In the above code fliplr used twice. So the image returns in the same form then if block is executed. Suppose, there are six images in the grid, each image is transformed either mirror or shear image transformation or original image displayed in the grid. How would I know which images is which kind of transform. Please help me.
function corr_verif()
mm = floor(1000+(rand()*8999))
trainingData=imageSet('D:\MATLAB\R2017a\bin\im2','recursive')
minSetCount=min([trainingData.Count])
I=trainingData(randi(numel(trainingData)));
helperDisplayImageMontage(I.ImageLocation(1:end))
count=1;
while count<=1
[x,y]=ginput(1)
count=count+1;
end
x=round(x);
y=round(y);
if(x<200)
if(y<200)
helperDisplayImageMontage(I.ImageLocation(1));
a=read(I,1);
a1=fliplr(a);
imshow(a1);
corr1=corr2(rgb2gray(a),rgb2gray(a1))
if(corr1>0.7)
disp('mirror');
else
if(corr1<0)
disp('shift');
else
disp('normal');
end
end
else
if((200<y)&(y<400))
helperDisplayImageMontage(I.ImageLocation(4))%teddy
a=read(I,4);
a1=fliplr(a);
corr1=corr2(rgb2gray(a),rgb2gray(a1))
if(corr1>0.7)
disp('mirror');
else
if(corr1<0)
disp('shift');
else
disp('normal');
end
end
end
end
else
if((200<x)&(x<400) &(y<200))
helperDisplayImageMontage(I.ImageLocation(2)) %cofe
a=read(I,2);
a1=fliplr(a);
corr1=corr2(rgb2gray(a),rgb2gray(a1))
if(corr1>0.9)
disp('mirror');
else
if(corr1<0)
disp('shift');
else
disp('normal');
end
end
else
if((x>400)&(x<600)&(y<200))
helperDisplayImageMontage(I.ImageLocation(3))
a=read(I,3);
a1=fliplr(a);
corr1=corr2(rgb2gray(a),rgb2gray(a1));
if(corr1>0.7)
disp('mirror');
else
if(corr1<0)
disp('shift');
else
disp('normal');;
end
end
%book
%net1(a,b,c,d);
else
if((200<x)&(x<400) &(200<y) &(x<400))
helperDisplayImageMontage(I.ImageLocation(5))
a=read(I,5);
a1=fliplr(a);
corr1=corr2(rgb2gray(a),rgb2gray(a1))
if(corr1>0.9)
disp('mirror');
else
if(corr1<0)
disp('shift');
else
disp('normal');
end
end
else
helperDisplayImageMontage(I.ImageLocation(6))
a=read(I,6);
a1=fliplr(a);
corr1=corr2(rgb2gray(a),rgb2gray(a1))
if(corr1>0.7)
disp('mirror');
else
if(corr1<0.7)
disp('shift');
else
disp('normal');
end
end
end
end
end
Image Analyst
Image Analyst le 5 Déc 2017
Take each test image and test it against both the original and the flipped version of the original. It will match either one of those, or if even one pixel is off it may not match either of them, especially if the number of rows or columns or color channels is not the same.
See this link for help in debugging your code if you don't understand what your code is doing.
Thank you sir.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by