Data loss in image

조회 수: 4 (최근 30일)
dani elias
dani elias 2022년 10월 15일
댓글: dani elias 2022년 10월 16일
I have an encrypted image,I wantit to like these so I can be able to test for data loss
  댓글 수: 7
dani elias
dani elias 2022년 10월 15일
Thank you
Jan
Jan 2022년 10월 16일
Remember that insertShape replies an RGB image.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2022년 10월 16일
Try this on your recovered image
% Create "recovered" image.
grayImage = imread('cameraman.tif');
grayImage = imnoise(grayImage, "gaussian", 0, .01);
[rows, columns, numberOfColorChannels] = size(grayImage)
rows = 256
columns = 256
numberOfColorChannels = 1
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)
numBlackPixels = 16384
% Assume it's a square and determine the width of the square
squareWidth = sqrt(numBlackPixels)
squareWidth = 128
% Get the rows of the square in the original image
row1 = round(rows/2 - squareWidth/2)
row1 = 64
row2 = round(rows/2 + squareWidth/2)
row2 = 192
% Get the columns of the square in the original image
col1 = round(columns/2 - squareWidth/2)
col1 = 64
col2 = round(columns/2 + squareWidth/2)
col2 = 192
% 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')
  댓글 수: 1
dani elias
dani elias 2022년 10월 16일
Thank you, this works perfect.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by