%% numregc: % function [outputs] = numregc() clear; clc; bmp=imread(test.bmp,bmp); gray=rgb2gray(bmp); bw=im2bw(gray,0.5);%transfer to char and white rate(1:10)=0; [height,width,d]=size(bw); % find the height/width/dimension of the bw picture [x,y]=find(bw==0); %0 represent black pixel Xmin = min(x); Xmax = max(x); Ymin = min(y); Ymax = max(y); W = Xmax-Xmin; H = Ymax-Ymin; dw = floor(W/10)+1; dh = floor(H/10)+1; % find the characteristic matrix matrix=zeros(10); for i=[Xmin:Xmax] for j=[Ymin:Ymax] if bw(i,j)==0 matrix(floor((i-Xmin)/dw)+1,floor((j-Ymin)/dh)+1)=1; end end end matrix=matrix; % find the characteristic vector charavetor=reshape(matrix,100,1); % %????????????? % for i=[0:9] % raw_data=[];% Nx100?? ????????? % file_id=fopen(strcat(char(i+48),.
txt),rb); % while feof(file_id) == 0 % [row_array, ele_count] = fread(file_id, 100); % if ele_count < 100 % elecount < 100???????????????? % break ; % else % % ?100x1?row_array???????1x100??? % row_array = row_array ; % % ????row_array???raw_data? % raw_data = [raw_data; row_array] ; % end % end % fclose(file_id); % raw_data=raw_data-48; % [m_data,n_data]=size(raw_data);%?????????? % nofrate=0;%num of rate % for m=[1:m_data] % count=0; % for n=[1:100] % if raw_data(m,n)==matrix(floor((n-1)/10)+1,mod(n-1,10)+1) % count=count+1; % end % end % if count>75 % nofrate=nofrate+1; % end % end % rate(i+1)=nofrate/m_data; % end raw_data0=[];% Nx100?? ????????? file_id=fopen(.txt,rb); while feof(file_id) == 0 [row_array, ele_count] = fread(file_id, 100); if ele_count < 100 % elecount < 100???????????????? break ; else % ?100x1?row_array???????1x100??? row_array = row_array ; % ????row_array???raw_data?... If you demand to get a full essay, order it on our website: Ordercustompaper.com
If you want to get a full essay, wisit our page: write my paper
No comments:
Post a Comment