필터 지우기
필터 지우기

How to return multiple image as output results by the for-loop of the function into the main

조회 수: 2 (최근 30일)
I want to get all the segmented lines image results from my functions into the main, but it only returns the last line of the input image.
here is the function for line segmenter code:
function mat5 = charextract(ipimg)
%aa=imread('num_ip.tif');
bb=rgb2gray(ipimg);
cc=imbinarize(bb);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% SEGMENTATION %%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[x,y]=size(cc);
ee=sum(cc,2);
mat2=y-ee;
mat3=mat2~=0;
mat4=diff(mat3);
index1=find(mat4);
[q,w]=size(index1);%size of index2 matrix is q*w
kap=1;
lam=1;
while kap<((q/2)+1)%number of loops=number of lines
k=1;
mat5=([]);
for j=(index1(lam)+1):1:index1(lam+1)
mat5(k,:)=cc(j,:); %store the line segmented matrix
%aadd{j}=mat5(k,:);
k=k+1;
end
lam=lam+2;
kap=kap+1;
%aa=mat5+1;
%figure, imshow(mat5);
end
end
Here is the main code:
close all;
clear all;
clc;
img=imread('num_ip.tif');
img2=charextract(img);
imshow(img2);
It return only the segmented last line of the input image.

답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by