Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need Advice on MATLAB Image Storage/Processing

Status
Not open for further replies.

Shyam Joe

Junior Member level 3
Junior Member level 3
Joined
Aug 21, 2013
Messages
28
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
322
hi friends i need a Matlab code to generate binary image by giving input matrix values. then i should convert it to grayscale image. for grayscale image direct values shouldnot be given. first a binary image should be generated and then it should be converted to grayscaale. Also is there any code to convert text to 256 bit binary number and 256 bit number to text.
 

hi.
1.If you don't want to use matlab fuctions for this purpose the following code generate a grayscle image to binary (note: threshold value is arbitary!)
%-------------------------------------------------
clc
clear all
close all
img=imread('your image');
[R C]=size(img);
img_bin=zeros(R,C);
threshold= 128;
[h_rows h_cols] = find(img >= threshold);
[l_rows l_cols] = find(img < threshold);
for i=1:size(h_rows,1)
img_bin(h_rows(i,:), h_cols(i,:) )=1;
end
for i=1:size(l_rows,1)
img_bin(l_rows(i,:), l_cols(i,:) )=0;
end
figure(1)
subplot(1,2,1)
imshow(img);
title( 'Original Image' );
hold on
subplot(1,2,2)
imshow(img_bin);
title( 'Binary Image' );
hold on
%------------------------------------------
2.for converting the binary image (which obtained above) to grayscle, i don't sure but this is the only way you should know that the pixel values before converting to binaty!!!

regards.
 

Please tell me the matlab code to compress and decompress an image. Thanks in advance
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top