Anyone with matlab installed - Read here.

[Prototype]

[Prototype]

@prototype-G9Gn5k Oct 25, 2024
Is there anyone here who have matlab installed in their computer? I need a little help. I need a couple of images to be converted into hex array and stored in text file.

I am attaching the files, so if you could do it, I would greatly appreciate it. If you want help with code, let me know. Its just 2 lines but I just forgot to bring matlab from home.

Thanks in advance.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • [Prototype]

    [Prototype]

    @prototype-G9Gn5k Nov 1, 2012

    Nvm... Sorted out.
  • Kaustubh Katdare

    Kaustubh Katdare

    @thebigk Nov 1, 2012

    It'd be great if you could post the solution to the problem. It'll definitely help others with similar problem.
  • [Prototype]

    [Prototype]

    @prototype-G9Gn5k Nov 1, 2012

    The_Big_K
    It'd be great if you could post the solution to the problem. It'll definitely help others with similar problem.
    Uh well, it wasn't a problem. I just didn't had matlab installed, that's why I wanted someone to read those image in matlab and convert the image vectors to hex and give it to me, so I can port it in the algorithm I am trying to implement in Verilog.

    Below is the code (I've commented it) for doing so. I just downloaded a lite version for Matlab 2006 and it did my work.

    A = imread('lenna_noise.gif');  % Read image
    z = dec2hex(A); %Convert to hex
    fid = fopen('lenna_noise.txt','w'); 
    fprintf(fid, [repmat('%x ', 1, size(z,256)), '\n'], z'); %write to text file in 255 X 255 fashion.
    fclose(fid);
    
  • arunchary

    arunchary

    @arunchary-VtqB3c Nov 1, 2012

    consider the image in to 24bit format in Mspaint in your system then go for using this file k.just load the picture and save in 24bit format k...
  • Jeffrey Arulraj

    Jeffrey Arulraj

    @jeffrey-xA7lUP Nov 2, 2012

    arunchary
    consider the image in to 24bit format in Mspaint in your system then go for using this file k.just load the picture and save in 24bit format k...
    Can you pls explain I am a little confused here

    If I have a .jpeg file then what will I have to do ?
  • [Prototype]

    [Prototype]

    @prototype-G9Gn5k Nov 2, 2012

    arunchary
    consider the image in to 24bit format in Mspaint in your system then go for using this file k.just load the picture and save in 24bit format k...
    My image is grayscale and not rgb. Besides, how will it convert the image into vectors?
  • EktaHitixa

    EktaHitixa

    @ektahitixa-eX1zHu Nov 2, 2012

    im
    [Prototype]
    Uh well, it wasn't a problem. I just didn't had matlab installed, that's why I wanted someone to read those image in matlab and convert the image vectors to hex and give it to me, so I can port it in the algorithm I am trying to implement in Verilog.

    Below is the code (I've commented it) for doing so. I just downloaded a lite version for Matlab 2006 and it did my work.

    A = imread('lenna_noise.gif');  % Read image
    z = dec2hex(A); %Convert to hex
    fid = fopen('lenna_noise.txt','w');
    fprintf(fid, [repmat('%x ', 1, size(z,256)), '\n'], z'); %write to text file in 255 X 255 fashion.
    fclose(fid);
    
    [/quote
    image should have .tif extension .jpg wont work
  • [Prototype]

    [Prototype]

    @prototype-G9Gn5k Nov 2, 2012

    EktaHitixa
    im
    Why not? I am not interested in raw image. I just wanted matrix form of my image for further processing. I am not trying to do compressions or similar hence raw image is not required for me.

    I was actually designing a median filter with some new sort algorithm as presented one of the IEEE paper.
  • arunchary

    arunchary

    @arunchary-VtqB3c Nov 2, 2012

    open an image in Mspaint in windows then save in the format of 24bit format ,then it can be accessed by matrices format as rows and columns...in C language and other languages to operate in hex format also..