already solved. Had an error in the second if statement relating with max value. max was a vector not a single value. Thnaks and sorry if someone tried.
Script skip code and breakpoints
3 次查看(过去 30 天)
显示 更早的评论
well i writed the next codes for images. it works well in simple image made in paint. but the moment i use a picture or a image more complex it start skiping part of the code. im using debbuging but it even skip the brakpoints. it could be for a max line text or what could be the reason.
%imagen a color
close all
conteo=0;
imagen=imread('Bofw21.jpg');
figure('Name','Figura original')
imshow(imagen);
conteo=conteo+1;
dimensiones_imagen=ndims(imagen);
if dimensiones_imagen>=2
imagen_a_color=imagen;
histograma_color=imhist(imagen);
figure('Name','Histograma a color');
bar(histograma_color);
conteo=conteo+1;
imagen=rgb2gray(imagen);
figure('Name','Imagen Gris');
imshow(imagen);
conteo=conteo+1;
end
valor_mas_alto=max(imagen);
if valor_mas_alto>=2
histograma_gris=imhist(imagen);
figure('Name','Histograma grises');
bar(histograma_gris);
FiltroPA=[-1 -1 -1;-1 -8 -1;-1 -1 -1]/9;
imagenPa=imfilter(imagen,FiltroPA);
figure('Name','Imagen Filtrada Pasa Alta');
imshow(not(imagenPa));
FiltroLaplaciano=[1 1 1;1 -8 1; 1 1 1];
imagenLapla=imfilter(imagen,FiltroLaplaciano);
figure('Name','Imagen Filtrado Laplaciano')
imshow(not(imagenLapla));
FiltroPB=[4 8 4; 8 16 8; 4 8 4]/64;
for filtrado=1:1:4
imagen=imfilter(imagen,FiltroPB);
end
figure('Name','Imagen Gris Filtrada Pasa Baja');
imshow(imagen);
for contraste=1:1:100
imagen=histeq(imagen);
end
figure('Name','imagen contrastada');
imshow(imagen);
conteo=conteo+1;
[renglon,columna]=size(imagen);
val=1;
divisiones_en_renglon=2;
divisiones_en_columna=4;
valreng=renglon/divisiones_en_renglon;
valcolum=columna/divisiones_en_columna;
division=uint8(zeros(valreng,valcolum,8));
piezas=false(zeros(valreng,valcolum,8));
%division
for divreng=1:1:divisiones_en_renglon
for divcolum=1:1:divisiones_en_columna
r1=divreng*valreng-valreng+1;
r2=divreng*valreng;
c1=valcolum*divcolum-valcolum+1;
c2=valcolum*divcolum;
division(:,:,val)=imagen(r1:r2,c1:c2);
val=val+1;
end
end
for cambio=1:1:8
logicalValue=graythresh(division(:,:,cambio));
piezas(:,:,cambio)=imbinarize(division(:,:,cambio),logicalValue);
end
val=1;
for divreng=1:1:divisiones_en_renglon
for divcolum=1:1:divisiones_en_columna
r1=divreng*valreng-valreng+1;
r2=divreng*valreng;
c1=valcolum*divcolum-valcolum+1;
c2=valcolum*divcolum;
imagen(r1:r2,c1:c2)=piezas(:,:,val);
val=val+1;
end
end
imagen=logical(imagen);
figure('Name','ImagenBinaria')
imshow(imagen);
histobin=imhist(imagen);
figure('Name','Histograma Binario')
bar(histobin);
conteo=conteo+1;
end %end de if
diamante=strel('diamond',6);
imagen=imdilate(imagen,diamante);
figure('Name','Imagen Dilatada')
imshow(imagen)
imnot=not(imagen);
bordes=edge(imnot,'Canny');
figure('Name','Bordes con Canny')
imshow(bordes)
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!