필터 지우기
필터 지우기

How to reduce code execution time ?

조회 수: 1 (최근 30일)
Nimisha
Nimisha 2018년 8월 8일
편집: KALYAN ACHARJYA 2018년 8월 8일
clc;
clear all;
%secret image
a=imread('secret1.bmp');
%a=rgb2gray(a);
a=a(:,:,1);
figure,
imshow(a);
title('secret image');
%cover image1
b=imread('secret2.bmp');
%b=rgb2gray(b);
b=b(:,:,1);
figure,
imshow(b);
title('Cover image 1');
%cover image2
e=imread('secret3.bmp');
e=e(:,:,1);
figure,
imshow(e);
title('Cover image 2');
d=uint8(zeros(size(a)));
%output
for i=1:256;
for j=1:256;
d(i,j)=bitset(d(i,j),8,bitget(e(i,j),8));
h=fi(b(i,j),0,8,0);
%b=bin(a);
k(i,j)=bitror(h,1);
g(i,j)= uint8(k(i,j));
d(i,j)=bitset(d(i,j),7,bitget(bitxor(a(i,j),(g(i,j))),7));
d(i,j)=bitset(d(i,j),6,bitget(bitxor(a(i,j),(g(i,j))),6));
d(i,j)=bitset(d(i,j),5,bitget(bitxor(a(i,j),(g(i,j))),5));
d(i,j)=bitset(d(i,j),4,bitget(bitxor(a(i,j),(g(i,j))),4));
d(i,j)=bitset(d(i,j),3,bitget(bitxor(a(i,j),(g(i,j))),3));
d(i,j)=bitset(d(i,j),2,bitget(bitxor(a(i,j),(g(i,j))),2));
d(i,j)=bitset(d(i,j),1,bitget(bitxor(a(i,j),(g(i,j))),1));
end
end
figure,
imshow(d);
title('output');
Above image Pixels having 8bits. I want to Read 1 to 7 BITS of Image1, and 8th BIT from Image2. And create a New Image then i want to Hide Image3 in Newly Created Image and want to Generate Output. Code for same is working very slow.! Please suggest to do fast operation.
  댓글 수: 1
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 8월 8일
편집: KALYAN ACHARJYA 2018년 8월 8일
Attach the images, so that we can try, What is the execution time in your case? use tic toc. Try to avoid multiple for loops

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

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by