필터 지우기
필터 지우기

How to get Pixels intensities on a circles with radii R for an image with selective angles?

조회 수: 7 (최근 30일)
How to get Pixels intensities on a circles with radii R for an image with selective angles?
  댓글 수: 4
KSSV
KSSV 2018년 1월 12일
You have these location on circle...do you have any other image, for which you want to extract the pixel values?

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2018년 1월 12일
Try this:
for k = 1 : length(x)
row = round(y(k)); % Round to nearest integer.
col = round(x(k)); % Round to nearest integer.
pixelValues(k) = grayImage(row, col);
end
  댓글 수: 8
Image Analyst
Image Analyst 2018년 1월 19일
There is no zeroth row or zeroth column. You need to have rows and columns start at 1.
Rashmi.D Jeya kumar
Rashmi.D Jeya kumar 2018년 1월 30일
편집: Rashmi.D Jeya kumar 2018년 1월 30일
clc;
clear all;
close all;
M= imread('alu foil.jpg') ;
I=rgb2gray(M);
%I=mat2gray(N);
I1=imgaussfilt(I,2);
I2=imgaussfilt(I1,2);
I3=imgaussfilt(I2,2);
subplot(2,2,1);imshow(I);title('orginal image', 'FontSize', 10);
subplot(2,2,2);
imshow(I1);
title('1st Blur', 'FontSize', 10);
subplot(2,2,3);
imshow(I2);
title('2nd Blur', 'FontSize', 10);
subplot(2,2,4);
imshow(I3);
title('3rd Blur', 'FontSize', 10);
[ro co]=size(I);
for r = 2 : ro - 1
for c = 2 : co - 1
centerPixel = I(ro, co);
end
end
meanval = mean2(I);
ELBP_CI = double((centerPixel-meanval) >= 0);
P neighbors of a central pixel are evenly distributed on a circle with radius R and have intensities denoted as gp;By comparing neighboring pixels with their average value denoted as uR
spatial relationships of pixels on two circles with radius R,R'
R= 40;
xc=size(I)/2+.5;
yc=size(I)/2+.5;
Angles = [0, 45, 90, 135, 180, 225, 270, 315, 360] ;
x = xc(1)+R*cos(Angles*pi/180) ;
y = yc(1)+R*sin(Angles*pi/180) ;
for k = 1 : length(x)
row = round(y(k));
col = round(x(k));
pixelvalue(k) = I(row, col);
end
neighb_pixelsaverage=(pixelvalue(1)/9)+(pixelvalue(2)/9)+(pixelvalue(3)/9)+(pixelvalue(4)/9)+(pixelvalue(5)/9)+(pixelvalue(6)/9)+(pixelvalue(7)/9)+(pixelvalue(8)/9)+(pixelvalue(9)/9);
ELBPNI=0;
for i=1 : length(pixelvalue)
L=pixelvalue(i)-neighb_pixelsaverage;
if(L>=0)
M=1;
end
if (L<0)
M=0;
end
ELBPNI(i)=M*(2^i);
ELBPNI=ELBPNI+ELBPNI(i);
end
ELBP_NI=ELBPNI;
R=70;
x = xc(1)+R*cos(Angles*pi/180) ;
y = yc(1)+R*sin(Angles*pi/180) ;
for k = 1 : length(x)
row = round(y(k));
col = round(x(k));
pixelvalue1(k) = I(row, col);
end
neighb_pixelsaverage1=(pixelvalue1(1)/9)+(pixelvalue1(2)/9)+(pixelvalue1(3)/9)+(pixelvalue1(4)/9)+(pixelvalue1(5)/9)+(pixelvalue1(6)/9)+(pixelvalue1(7)/9)+(pixelvalue1(8)/9)+(pixelvalue1(9)/9);
ELBPNI=0;
for i=1 : length(pixelvalue)
L=pixelvalue1(i)-neighb_pixelsaverage1;
if(L>=0)
M=1;
if(L<0)
M=0;
end
ELBPNI1(i)=M*(2^i);
ELBPNI1=ELBPNI1+ELBPNI1(i);
end
end
ELBP_NI1=ELBPNI1;
for i=1 : length(pixelvalue)
L=pixelvalue(i)-pixelvalue1(i);
if(L>=0)
M=1;
if(L<0)
M=0;
end
ELBPRD(i)=M*(2^i);
ELBPRD=ELBPRD+ELBPRD(i);
end
end
ELBP_RD=ELBPRD;
I didnt complete entire code.up to this the code is right or any modifications?
clc;
clear all;
close all;
M= imread('alu foil.jpg') ;
I=rgb2gray(M);
%I=mat2gray(N);
I1=imgaussfilt(I,2);
I2=imgaussfilt(I1,2);
I3=imgaussfilt(I2,2);
subplot(2,2,1);imshow(I);title('orginal image', 'FontSize', 10);
subplot(2,2,2);
imshow(I1);
title('1st Blur', 'FontSize', 10);
subplot(2,2,3);
imshow(I2);
title('2nd Blur', 'FontSize', 10);
subplot(2,2,4);
imshow(I3);
title('3rd Blur', 'FontSize', 10);
[ro co]=size(I);
for r = 2 : ro - 1
for c = 2 : co - 1
centerPixel = I(ro, co);
end
end
meanval = mean2(I);
ELBP_CI = double((centerPixel-meanval) >= 0);
R= 40;
xc=size(I)/2+.5;
yc=size(I)/2+.5;
Angles = [0, 45, 90, 135, 180, 225, 270, 315, 360] ;
x = xc(1)+R*cos(Angles*pi/180) ;
y = yc(1)+R*sin(Angles*pi/180) ;
for k = 1 : length(x)
row = round(y(k));
col = round(x(k));
pixelvalue(k) = I(row, col);
end
neighb_pixelsaverage=(pixelvalue(1)/9)+(pixelvalue(2)/9)+(pixelvalue(3)/9)+(pixelvalue(4)/9)+(pixelvalue(5)/9)+(pixelvalue(6)/9)+(pixelvalue(7)/9)+(pixelvalue(8)/9)+(pixelvalue(9)/9);
ELBPNI=0;
for i=1 : length(pixelvalue)
L=pixelvalue(i)-neighb_pixelsaverage;
if(L>=0)
M=1;
end
if (L<0)
M=0;
end
ELBPNI(i)=M*(2^i);
ELBPNI=ELBPNI+ELBPNI(i);
end
ELBP_NI=ELBPNI;
R=70;
x = xc(1)+R*cos(Angles*pi/180) ;
y = yc(1)+R*sin(Angles*pi/180) ;
for k = 1 : length(x)
row = round(y(k));
col = round(x(k));
pixelvalue1(k) = I(row, col);
end
neighb_pixelsaverage1=(pixelvalue1(1)/9)+(pixelvalue1(2)/9)+(pixelvalue1(3)/9)+(pixelvalue1(4)/9)+(pixelvalue1(5)/9)+(pixelvalue1(6)/9)+(pixelvalue1(7)/9)+(pixelvalue1(8)/9)+(pixelvalue1(9)/9);
ELBPNI=0;
for i=1 : length(pixelvalue)
L=pixelvalue1(i)-neighb_pixelsaverage1;
if(L>=0)
M=1;
if(L<0)
M=0;
end
ELBPNI1(i)=M*(2^i);
ELBPNI1=ELBPNI1+ELBPNI1(i);
end
end
ELBP_NI1=ELBPNI1;
for i=1 : length(pixelvalue)
L=pixelvalue(i)-pixelvalue1(i);
if(L>=0)
M=1;
if(L<0)
M=0;
end
ELBPRD(i)=M*(2^i);
ELBPRD=ELBPRD+ELBPRD(i);
end
end
ELBP_RD=ELBPRD;

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

KSSV
KSSV 2018년 1월 12일
편집: KSSV 2018년 1월 12일
I = imread('alu foil.jpg') ;
[nx,ny,d] = size(I) ;
%%define your circle
R= 10 ;
figure
hold on
imshow(I) ;
[xc,yc] = getpts() ; % extract the center of circle
%
Angles = [0, 45, 90, 135, 180, 225, 270, 315, 360] ; % location in degrees
% In polar coordinates
iwant = [R*ones(1, length(Angles)); Angles*pi/180] ;
% In cartesian coordinates
x = xc(1)+R*cos(Angles*pi/180) ;
y = yc(1)+R*sin(Angles*pi/180) ;
%
hold on
plot(x,y,'*r') ;
%%Do interpolation to get pixels
R = uint8(interp2(1:ny,1:nx,double(I(:,:,1)),x,y)) ; % Red Channel
G = uint8(interp2(1:ny,1:nx,double(I(:,:,2)),x,y)) ; % Green Channel
B = uint8(interp2(1:ny,1:nx,double(I(:,:,3)),x,y)) ; % Blue Channel
When prompted...click at a point, where you want the circle to be. This point will be the center of circle.

카테고리

Help CenterFile Exchange에서 Deep Learning for Image Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by