您好,欢迎来到爱玩科技网。
搜索
您的当前位置:首页寻找矩形块

寻找矩形块

来源:爱玩科技网
clc;
close all;
clearvars;
img = imread('D:\Program Files (x86)\Tencent\QQ_data\491415198\FileRecv\sampleImage.bmp');
figure,imshow(img)
[count,bin] = imhist(img,256);
figure,stem(bin, count,'marker','none');
thresh = graythresh(img);
bw =im2bw(img, thresh);
figure,imshow(bw)

val1 = img(img>thresh*255);
thresh1 = otsu_thresh(val1);
bw1 = img>thresh1*255;
figure;imshow(bw1);

val2 = img(thresh*255<img & img<thresh1*255);
thresh2 = otsu_thresh(val2);
bw2 = thresh<img&img<thresh2*255;
figure, imshow(bw2);

se = ones(5);
bw3 = imopen(bw2,se);
figure,imshow(bw3);
bw4 = imerode(bw3,se);
figure,imshow(bw4);
imgy = sum(bw3,2);figure,plot(imgy);
imgx = sum(bw3,1);figure,plot(imgx);


left = img(1:end,100:320);
histeq(left,256)
[left1] = histeq(left,256);
left2 =im2bw(left1,graythresh(left1));
figure,imshow(left2);

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- aiwanbo.com 版权所有 赣ICP备2024042808号-3

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务