이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
How to get Pixels intensities on a circles with radii R for an image with selective angles?
조회 수: 3 (최근 30일)
이전 댓글 표시
How to get Pixels intensities on a circles with radii R for an image with selective angles?
댓글 수: 4
Rashmi.D Jeya kumar
2018년 1월 12일
편집: Walter Roberson
2018년 1월 12일
Angles = [0, 45, 90, 135, 180, 225, 270, 315, 360] ; % location in degrees
% In polar coordinates
R=3;
iwant = [repmat(R,1, length(Angles)); Angles*pi/180]
% In cartesian coordinates
x = R*cos(Angles*pi/180) ;
y = R*cos(Angles*pi/180) ;
sir here where I insert my input image?
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
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
2018년 1월 12일
You assigned it. You said R was = 3. Remember your code that you posted:
Angles = [0, 45, 90, 135, 180, 225, 270, 315, 360] ; % location in degrees
% In polar coordinates
R=3;
iwant = [repmat(R,1, length(Angles)); Angles*pi/180]
% In cartesian coordinates
x = R*cos(Angles*pi/180) ;
y = R*cos(Angles*pi/180) ;
See where it assigns the radius to 3? You did that. By the way, you can use cosd instead of cos, and sind instead of cos (which you wrongly used):
x = R * cosd(Angles); % The "d" versions take angles in degrees, not radians.
y = R * sind(Angles);
Image Analyst
2018년 1월 12일
Well of course you were supposed to realize that you need to replace the image variable, grayImage, with the actual name of the variable in your program.
Maybe you didn't call it something useful and descriptive like grayImage. Maybe you called it I or X or something. Tell me exactly what you called your image variable when you called imread() (or somehow otherwise created it).
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
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
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.
댓글 수: 1
Rashmi.D Jeya kumar
2018년 1월 12일
Thank you sir!! I am not geting the pixel value if R,G,B in comnd windw R=G=B (ie) same value.
참고 항목
카테고리
Help Center 및 File 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!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)