Data loss in image
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
dani elias
el 15 de Oct. de 2022
Comentada: dani elias
el 16 de Oct. de 2022
I have an encrypted image,I wantit to like these so I can be able to test for data loss
7 comentarios
Respuesta aceptada
Image Analyst
el 16 de Oct. de 2022
Try this on your recovered image
% Create "recovered" image.
grayImage = imread('cameraman.tif');
grayImage = imnoise(grayImage, "gaussian", 0, .01);
[rows, columns, numberOfColorChannels] = size(grayImage)
subplot(2, 1, 1);
imshow(grayImage, []);
title('Initial Image')
% Define fraction of pixels to blacken in the middle.
pct = 0.25;
% Determine how many pixels that is.
numBlackPixels = pct * numel(grayImage)
% Assume it's a square and determine the width of the square
squareWidth = sqrt(numBlackPixels)
% Get the rows of the square in the original image
row1 = round(rows/2 - squareWidth/2)
row2 = round(rows/2 + squareWidth/2)
% Get the columns of the square in the original image
col1 = round(columns/2 - squareWidth/2)
col2 = round(columns/2 + squareWidth/2)
% Do the blackening:
grayImage2 = grayImage; % Initialize
grayImage2(row1:row2, col1:col2) = 0; % Blacken square in the middle
subplot(2, 1, 2);
imshow(grayImage2, [])
title('Output Image')
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Segmentation and Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!