how to extract pixels value of extremity of image

2 ビュー (過去 30 日間)
bay rem
bay rem 2016 年 1 月 2 日
回答済み: harjeet singh 2016 年 1 月 2 日
hello everyone, i have an image (a) and i wanna test if the ligne (red) is red with width=2 pixels, the ligne (green) is green with width=2 pixels...
thank you
  2 件のコメント
harjeet singh
harjeet singh 2016 年 1 月 2 日
your red is not a pure red and even red is with gradient so what you want to test
bay rem
bay rem 2016 年 1 月 2 日
編集済み: bay rem 2016 年 1 月 2 日
thnak you but whatever the intensity of the color, how can i test it automatically?

サインインしてコメントする。

回答 (1 件)

harjeet singh
harjeet singh 2016 年 1 月 2 日
try to use this code
clear all
close all
clc
img=imread('images.jpg');
figure(1)
imshow(img)
drawnow
b=(img(:,:,1)>30 | img(:,:,2)>130 | img(:,:,3)>30);
% figure(2)
% imshow(b)
c=b(round(size(b,1)/2),:);
d=b(:,round(size(b,2)/2));
c1=double(c) - double([0 c(1:end-1)]);
[r1,c1]=find(c1==1);
right_vertical_border=(size(b,2)-max(c1)) + 1
c1=double(d) - double([0;d(1:end-1)]);
[r1,c1]=find(c1==-1);
top_upper_border=min(r1)
right_vertical_border =
5
top_upper_border =
5

Community Treasure Hunt

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

Start Hunting!

Translated by