找回密码
 注册
Simdroid-非首页
查看: 183|回复: 5

matlab计算红色区域的面积

[复制链接]
发表于 2016-6-27 17:00:24 | 显示全部楼层 |阅读模式 来自 河南平顶山
matlab计算红色区域的面积,求解,谢谢了

本帖子中包含更多资源

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

×
 楼主| 发表于 2016-6-27 17:07:28 | 显示全部楼层 来自 河南平顶山
Simdroid开发平台
求大神帮帮,没学过这个软件,只是用这个软件计算下红色区域的面积:)
回复 不支持

使用道具 举报

 楼主| 发表于 2016-6-27 17:25:20 | 显示全部楼层 来自 河南平顶山
有没有人呀:$
回复 不支持

使用道具 举报

 楼主| 发表于 2016-6-27 17:29:52 | 显示全部楼层 来自 河南平顶山
clc;
clear;
close all;
I = imread('D:\Matlab处理图\10mm 30° 60mm.jpg');
% 提取R,G,B
I1 = I(:,:,1);
I2 = I(:,:,2);
I3 = I(:,:,3);
% 二值化R,G,B
J1 = im2bw(I1);
J2 = im2bw(I2);
J3 = im2bw(I3);
% 连通块分析R,G,B
[L1,num1] = bwlabel(J1);num1
[L2,num2] = bwlabel(J2);num2
[L3,num3] = bwlabel(J3);num3
% 显示
figure;
subplot(2,2,1);
imshow(I);
title('Origin')
subplot(2,2,2);
imshow(I1);
title('R')
subplot(2,2,3);
imshow(I2);
title('G')
subplot(2,2,4);
imshow(I3);
title('B')
figure;
subplot(2,3,1);
imshow(J1);
title('R-Gray')
subplot(2,3,2);
imshow(J2);
title('G-Gray')
subplot(2,3,3);
imshow(J3);
title('B-Gray')
subplot(2,3,4);
imshow(L1);
title('R-Label')
subplot(2,3,5);
imshow(L2);
title('G-Label')
subplot(2,3,6);
imshow(L3);
title('B-Label')
% 整合
L = [];
for i = 1:size(L1,1)   
   for j = 1 : size(L1,2)        
       temp = [L1(i,j) L2(i,j) L3(i,j)];        
       if temp == zeros(1,3)            
          L(i,j) = 0;        
        else            
           if L1(i,j)~= 0               
               L(i,j) = L1(i,j);               
               continue;            
            elseif L2(i,j) ~= 0               
               L(i,j) = L2(i,j);               
               continue;            
            elseif L3(i,j) ~= 0               
               L(i,j) = L3(i,j);               
               continue;            
            end        
          end   
        end
end
% 显示
figure;
imshow(L);
for color=1:num1      
    temp=I(I==color);      
    [label,n]=bwlabel(temp);      
    area=regionprops(label,'Area')
end
这个是网上找的命令不知道对不对
回复 不支持

使用道具 举报

 楼主| 发表于 2016-6-27 17:35:09 | 显示全部楼层 来自 河南平顶山
C:\用户\Administrator\桌面
回复 不支持

使用道具 举报

发表于 2017-8-6 15:36:37 | 显示全部楼层 来自 河北唐山
学习了,支持一下。
回复 不支持

使用道具 举报

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

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-4-24 09:06 , Processed in 0.028742 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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