Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1500|回复: 0

图像识别实验

[复制链接]

391

主题

1222

帖子

3902

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3902
发表于 2023-6-12 17:27:05 | 显示全部楼层 |阅读模式

  1. I = imread('count.png');
  2. subplot(2,3,1);imshow(I);
  3. I_gray = rgb2gray(I);
  4. I_bw = I_gray< 100;
  5. subplot(2,3,2);imshow(I_bw,[]);
  6. I_circle = zeros(size(I_bw));
  7. [I_label,num] = bwlabel(I_bw);
  8. subplot(2,3,3);imshow(I_label,[]);
  9. for i = 1:num
  10.     I_bw1 = I_label == i;
  11.     subplot(2,3,4);imshow(I_bw1,[]);
  12.     S1 = sum(sum(I_bw1));
  13.     I_edge1 = abs(imfilter(double(I_bw1)...
  14.     ,[-1,1]));
  15.     I_edge2 = abs(imfilter(double(I_bw1)...
  16.     ,[-1;1]));
  17.     I_edge = (I_edge1 +I_edge2 )>0;
  18.     subplot(2,3,5);imshow(I_edge,[]);
  19.     L = sum(sum(I_edge));
  20.     R = 4*pi*S1/L^2
  21.     if R > 0.8
  22.         I_circle = I_circle + I_bw1;
  23.     end
  24. end
  25. subplot(2,3,6);imshow(I_circle,[]);
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|DiscuzX

GMT+8, 2025-4-13 00:01 , Processed in 0.042430 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表