0 Replies - 610 Views - Last Post: 24 May 2012 - 05:58 AM Rate Topic: -----

#1 Koryor  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-May 12

Convert .m to VHDL file

Posted 24 May 2012 - 05:58 AM

Hi,All

I would like to convert my Matlab code to be VHDL code. I want to find out about the possibility to implement this code (algorithm) in real hardware.
I never use simulink. So what is the other ways to convert it?
Please help and suggest.

Koryor

My code ;
 
        I = imread('C...');
        Ig = rgb2gray(I);
        Ie = edge(Ig,'canny');
        se90 = strel('diamond',2);
        Id = imdilate(Ie, se90);
      
        mask = imfill(Id,'holes');
        [ny nx] = size(mask);
        mask2 = zeros(ny,nx);
        for jj=1:ny
            for ii=1:nx
                if (mask(jj,ii) == 1)
                    mask2(jj,ii) = 0;
                else
                    mask2(jj,ii) = 1;
                end
            end
        end
        
        I3=zeros(ny,nx,3);
        for jj=1:ny
            for ii=1:nx
                if (mask2(jj,ii)==0) %
                    I3(jj,ii,1) = I(jj,ii,1); 
                    I3(jj,ii,2) = I(jj,ii,2);
                    I3(jj,ii,3) = I(jj,ii,3);
                else %if white (1) -> White
                    I3(jj,ii,1) = 255; % white
                    I3(jj,ii,2) = 255; % white
                    I3(jj,ii,3) = 255; % white
                end
            end
        end
       
        [c,s] = wavedec2(I3,3,'bior4.4');        

        alpha = 1.5; 
        m = 2.7*prod(s(1,:)/>);
        [thr,nkeep] = wdcbm2(c,s,alpha,m);

        [xd,cxd,sxd,perf0,perfl2] = wdencmp('lvd',c,s,'bior4.4',3,thr,'s');
        
        R = waverec2(c,s,'bior4.4');
        rc = uint8(R);



I am looking forward to hear from you.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1