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.

Convert 256 colours image in a 8 colours image and save pixels in a file

Status
Not open for further replies.

madalin1990

Full Member level 2
Joined
Apr 4, 2012
Messages
124
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,090
I need help in converting a 256 colour image in an 8 colour image and the save the bits of this image in a file.This file will the be read using verilog function readmemh.
Here it is what I have so far:
-i have read the original image
Code:
imfile = fullfile('griphon.jpg');
original_image = imread(imfile,'JPG');
figure('Name','RGB Truecolor Image')
imagesc(original_image)
axis image
zoom(0)
-i think i converted it to 8 colours:
Code:
% % Convert RGB to an indexed image with 8 colors
[IND,map] = rgb2ind(original_image,8);
figure('Name','Indexed image with 8 Colors')
imagesc(IND)
colormap(map)
axis image
zoom(0)

But now i do not know how to read the pixels to a file.
I would be grateful if someone could verify what i have so far and also tell me how to save these pixels.
 

I have managed to write the script that is converting the images,but i still can't figure out how to write the pixels value in a file.
 

Although no one has responded so far ,I will ask another question hoping someone will finally give an answer.
I have a matrix X that it is written in a file.I want that any value written to be written in this format:
''assign mem = value",where i is the location obtained from line*column and value is the corresponding matrix value.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top