필터 지우기
필터 지우기

WHEN I AM EXECUTING THIS CODE I GET A JULIA IMAGE .HOW CAN I READ THIS IMAGE IN THE CODE AND USE THIS TO GENERATE KEY FOR ENCRYPTION CRYPTION

조회 수: 2 (최근 30일)
x = linspace(-1.3,1.3,501);
y = linspace(-1.3,1.3,501);
[X,Y] = meshgrid(x,y);
C = ones(size(X))*(0.360284+0.100376*1i);
Z_max = 1e6; it_max = 50;
Z = complex(X,Y);
B = zeros(size(C));
for k = 1:it_max
Z = Z.^2 + C;
B = B + (abs(Z)<2);
end
% only show those bounded points
imagesc(B);
colormap(jet);
title('Julia Set "Dragon" for $c=0.360284+0.100376i$','FontSize',16,'interpreter','latex');
axis off
When i am running this i am getting "B does not exist"
I=imread('B.extenstion');
imshow(I)
title('Input Image')
I1=rgb2gray(I);
figure,imshow(I1)
title('gray converted Image')
  댓글 수: 3
Walter Roberson
Walter Roberson 2022년 8월 7일
Due to the laws of the United States, we cannot discuss encryption techniques.

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

채택된 답변

Walter Roberson
Walter Roberson 2022년 8월 7일
편집: Walter Roberson 2022년 8월 8일
Bre = im2uint8(rescale(B));
imgfile = 'B.png';
cmap = jet;
Bc = ind2rgb(Bre, cmap) ;
imwrite(Bc, imgfile)
I = imread(imgfile);
I and Bc should be exactly the same after this.

추가 답변 (1개)

Image Analyst
Image Analyst 2022년 8월 7일
Evidently "B.extenstion" does not exist. Maybe you wanted extenstion to be png or tif or something. Try this:
fileName = fullfile(pwd, 'B.png'); % or whatever the actual extension is.
if ~isfile(fileName)
errorMessage = sprintf('ERROR: this file does not exist:\n%s', fileName);
uiwait(errordlg(errorMessage));
return;
end
% Else the file does exist.
I = imread(fileName);
  댓글 수: 3
Image Analyst
Image Analyst 2022년 8월 8일
They did not explicitly ask how to save B, and I assume they were able to save it. They did however ask how to read the file back from disk and got an error about the file not existing. I assume they saved it with a name other than 'B.extenstion'. I actually did not add much (they already knew they had to use imread) -- I just basically threw up a friendlier error message if they got the filename wrong.
Walter Roberson
Walter Roberson 2022년 8월 8일
편집: Walter Roberson 2022년 8월 8일
"How can i get B as a image and read it?"
Reading B as an image requires saving it as an image.
With the imagesc and jet colormap I would not assume that they know how to save the array as an image.

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

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by