f



I have a m-file that I compiled into a dll using MatLab compiler. I then created a C# library class to call the MatLab dll

hi,
>i creat an M-file which has an imagen in file then in matlab i create it dll using >deploytool 
>Then i include this dll in visual studio 2005 C#.Net project
>Then i make a windows form which has a button,picturebox,textbox openfiledialog
>what should be the code of button it access the m-file from matlab show its path in >textbox and image in picture box or
>what is the procedure of accesing matlab file from C#.Net,plz help me for this >problem immediatley
>my code of m-file is
function aa

%Ori_Face=imread('E:\Shakir\Faisal\Face\sub6.1.jpg');

%Ori_Face=imread('E:\Shakir\Faisal\Face\sub6.12.jpg');
%Ori_Face=imread('E:\Shakir\Faisal\Face\sub6.13.jpg');
Ori_Face=imread('F:\face_extraction\sub6.12.jpg');

%Ori_Face=imread('C:\Program Files\MATLAB704\work\FYP\sub6.1.jpg');
copy=Ori_Face;

[M N]=size(copy)


r=single(M*N)
g=single(M*N)
b=single(M*N)

Chrom=rgb2ycbcr(copy);


for i=1:size(Chrom,1)%Read row pixels
    for j=1:size(Chrom,2)%Read column pixels
        %This conditions will determine the face based on RGB colour value
   
        if (105<Chrom(i,j,1)<117 && 110<Chrom(i,j,2)<113 && Chrom(i,j,3)>128)%why i can't extract blue color properly?
            
            r(i,j)=copy(i,j,1);
            g(i,j)=copy(i,j,2);
            b(i,j)=copy(i,j,3);
        %        copy(i,j,1)=0;                                                   %is my condition have any mistakes?
   %         copy(i,j,2)=0;
     %       copy(i,j,3)=255;                                                 %i get my pixel value by pixel region tool/
        
        %If above conditions is not meet, other colour values will be set to 255 (white)    
        else
            r(i,j)=255;
            g(i,j)=255;
            b(i,j)=255;
%            copy(i,j,1)=255;
%            copy(i,j,2)=255;
%            copy(i,j,3)=255;
            
        end
   
    end
end


rgb = cat(3, r, g, b);
figure,imshow(rgb);
imshow(uint8(rgb), 'InitialMagnification', 'fit')



%help-------------------------
   
      
rgb=uint8(rgb);
l=rgb;
       %alif_gray=rgb2gray(rgb);
       alif_gray=rgb;
    img_alif=graythresh(alif_gray);
    img_bin=im2bw(alif_gray,img_alif);
%        img_bin(1,1)=0;
%        img_bin(145,87)=0;
    img_bin;
   figure,imshow(img_bin);
    img_comp=imcomplement(img_bin);
            [r,c] = find(img_comp==1);
        % Extract letter
        %imshow(rgb);
         r=rgb(:,:,1);
         g=rgb(:,:,2);
         b=rgb(:,:,3);
         
        %l=l(min(r):max(r),min(c):max(c));
        t=r;
        %c=l;
         r=r(min(t):max(c),min2(t):max2(c)); 
%          g=g(min(r):max(r),min(c):max(c));
%          b=b(min(r):max(r),min(c):max(c));
       
       %imga= cat(3,r,g,b);
       %imgr=r+g+b;
       figure,imshow(imgr);
       
       

% h = fspecial('prewitt');
% filteredRGB = imfilter(copy, h);
% imshow(filteredRGB);

%important
%imtool(rgb);
%imtool(copy);
%imtool(Chrom)
0
zebi
8/27/2010 1:59:07 AM
comp.soft-sys.matlab 211265 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
1481 Views

Similar Articles

[PageSpeed] 49

Reply: