How do you change pixels in an image?

i want to get the difference between two pixel and then i want to chang pixel value to become yellow . please help!!!!

답변 (3개)

Jan
Jan 2012년 2월 19일

0 개 추천

The question is not clear. Are you talking about RGB images? Which pixel should be set to yellow? Perhaps this helps:
image1 = rand(100,100,3);
image2 = rand(100,100,3);
diffPixel = image1(51,67,:) - image2(51,67,:);
image1(51,67,:) = [1, 1, 0];

댓글 수: 3

Isee You
Isee You 2012년 2월 19일
i work in gray image (2d) and i want to to get the difference between two pixel and if the difference is small than Specific number . I colored a pixel yellow(any pixel i want)
Image Analyst
Image Analyst 2012년 2월 19일
Try this first: http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
Then come back and tell us which two pixels you want to take the difference of and which pixels you want to set to yellow. Do you want to convert your gray scale image to RGB color now? Or do you want to apply a colormap? Do you have any photos that you uploaded to tinypic.com that you can show us? You need to put some work into your question, more than 10 seconds anyway. Because as I see it, Jan has answered your question. If not, you need to explain why.
Isee You
Isee You 2012년 2월 24일
any help

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

Isee You
Isee You 2012년 2월 21일

0 개 추천

OK i will try as possible. my project is locate dark part in this image and isolate it
i read this sheet
ok.

댓글 수: 3

Image Analyst
Image Analyst 2012년 2월 22일
Do you mean the dark part between the outer body wall and the internal organs?
Isee You
Isee You 2012년 2월 22일
no the small dark part inside the liver .
Image Analyst
Image Analyst 2012년 2월 22일
Give us some code to start with. I don't want to develop the whole app from scratch for you.

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

Isee You
Isee You 2012년 2월 22일

0 개 추천

i isolate the liver and then i use this code to get the difference between the pixels (x.jpg)is my image of liver only.
function test4_loop(img)
a = imread('x,jpg');
[xx,yy]=size(a);
for x=1:(xx-3)
for y=1:(yy-3)
z1=impixel (a,x,y)
z2=impixel (a,x,(y+1));
z3=impixel (a,x,(y+2));
z4=impixel (a,(x+1),(y));
z5=impixel (a,(x+1),(y+1));
z6=impixel (a,(x+1),(y+2));
z7=impixel (a,(x+2),(y));
z8=impixel (a,(x+2),(y+1));
z9=impixel (a,(x+2),(y+2));
z=[z1 z2 z3;
z4 z5 z6;
z7 z8 z9];
avg=mean2(z);
do(avg,x,y);
end
end
function do(mean,x,y)
a=imread('x.jpg');
%north eset
while x>0 && y>0
r=mean-a(x-1,y-1);
x=x-1;
y=y-1;
end
%north
while x>0 && y>0
r=mean-a(x-1,y+1);
x=x-1;
end
%north west
while x>0 && y>0
r=mean-a(x-1,y+2);
x=x-1;
y=y+1;
end
%west
while x>0 && y>0
r=mean-a(x+1,y+3);
y=y+1;
end
%north west
while x>0 && y>0
r=mean-a(x+3,y+3);
x=x+1;
y=y+1;
end
%norht
while x>0 && y>0
r=mean-a(x+3,y+1);
x=x-1;
y=y-1;
end
%north east
while x>0 && y>0
r=mean-a(x+3,y-1);
x=x+1;
y=y-1;
end
%eset
while x>0 && y>0
r=mean-a(x+1,y-1);
y=y-1;
end
you can see this file to understand what i mean about (x,y)

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2012년 2월 19일

편집:

dpb
2013년 10월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by