How can we get back our original image after jumbling. Is there any reverse method in matlab??

5 visualizzazioni (ultimi 30 giorni)
I have an image and i apply row shuffling on it..now i want my original image back. How it is possible.

Risposta accettata

Ingrid
Ingrid il 9 Mar 2015
you can only do this when you also have stored information on the indices that were used for the shuffling.
for example if you would have used sort on your matrix
[Asorted, idx] = sort(A);
than you could get the original A back by
Aorg = Asorted(idx);
If you did not store this information, than it is not possible to "reverse" anything in matlab

Più risposte (1)

Image Analyst
Image Analyst il 9 Mar 2015
Try this horizontal shuffling:
fontSize = 20;
grayImage = imread('cameraman.tif');
[rows, columns] = size(grayImage);
subplot(1, 3, 1);
imshow(grayImage);
title('Original Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
% Scramble the image
randomRows = randperm(rows);
shuffledImage = grayImage(randomRows, :);
subplot(1, 3, 2);
imshow(shuffledImage);
title('Shuffled Image', 'FontSize', fontSize);
% Restore the image
% First find out where the random rows came from.
[~, originalRows] = sort(randomRows);
% Now, "unshuffle".
restoredImage = shuffledImage(originalRows, :);
subplot(1, 3, 3);
imshow(restoredImage);
title('Restored Image', 'FontSize', fontSize);
For a 2D scrambling, see my attached demo.

Categorie

Scopri di più su Images in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by