Advanced MATLAB. 046746. Topics. Data Types Image Representation Image/Video I/O Matrix access Image Manipulation MEX - MATLAB Executable Data Visualization General Tips Tricks. Data Types. Relevant data types double – default in most cases (usually 64 bit)
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Advanced MATLAB
046746
I = imread('world.jpg');
I2 = I-1.4;
diffI = I-I2;
fprintf('Max difference between images: %d\n',max(diffI(:)));
Max difference between images: 1
fprintf('Max difference between images: %2.1f\n',max(diffI(:)));
Max difference between images: 1.4
A much better practice is:
display([ 'Max difference between images: ' num2str( max(diffI(:)) ) ]);
Max difference between images: 1.4
2D Matrix
2D Matrix
3D Matrix
Useful Commands
Useful Commands:
Useful Commands:
Useful Commands:
function myfun
A = magic(500);
function setrowval(row, value)
A(row,:) = value;
end
setrowval(400, 0);
disp('The new value of A(399:401,1:10) is')
A(399:401,1:10)
end
function x = demo
x=rand(10000);
x=func(x);
function a=func(a)
a=a*2;
tic
x = 0;
for k = 2:1000000
x(k) = x(k-1) + 5;
end
toc
Elapsed time is 0.301528seconds.
tic
x = zeros(1, 1000000);
for k = 2:1000000
x(k) = x(k-1) + 5;
end
toc
Elapsed time is 0.011938seconds.
A = int8(zeros(100));
A = zeros(100, 'int8');
Long-Term Usage (Windows Systems Only)
On 32-bit Microsoft Windows, the workspace of MATLAB can fragment over time due to the fact that the Windows memory manager does not return blocks of certain types and sizes to the operating system. Clearing the MATLAB workspace does not fix this problem. You can minimize the problem by allocating the largest variables first. This cannot address, however, the eventual fragmentation of the workspace that occurs from continual use of MATLAB over many days and weeks, for example. The only solution to this is to save your work and restart MATLAB.
The pack command, which saves all variables to disk and loads them back, does not help with this situation.
Stenography (Wikipedia)
The art of hiding a message within another larger message
?
Stenography (Wikipedia)
The art of hiding a message within another larger message
I= imread('StenographyOriginal.png');
I4=85*mod(I,4);
figure;
subplot(1,2,1)
imshow(I); title('Original');
subplot(1,2,2)
imshow(I4);title('Result');
Almost Connected (Steve Eddins’ Blog)
Almost Connected (Steve Eddins’ Blog)
url = 'http://blogs.mathworks.com/images/steve/2010/blobs_in_clumps.png';
bw = imread(url);
lbl = bwlabel(bw);
figure; imagesc(lbl); axis image;
Almost Connected (Steve Eddins’ Blog)
bw2 = bwdist(bw) <= 12.5;
lbl2 = bwlabel(bw2);
figure; imshow(bw2);
figure; imagesc(lbl2); axis image;
Almost Connected (Steve Eddins’ Blog)
lbl3 = lbl2.*bw;
figure;
imagesc(lbl3); axis image;
Feature AND (Steve Eddins’ Blog)
bw = imread('text.png');
dots = rand(size(bw))>0.99;
Feature AND (Steve Eddins’ Blog)
touching_pixels = bw & dots;
Feature AND (Steve Eddins’ Blog)
out = imreconstruct(touching_pixels, bw);
Of course this will work just as well:
out = imreconstruct(dots, bw);