MATLAB: How can use [c r p]=impixel(‘img1.png’); turn to an knowing [c r] to impixel image

impixel

firstimage=imread('img1.png');
[c r p]=impixel(firstimage);
There is my question:
I can use the code above so for the first image I can get a value to impixel,
and now I want to use the same range,to do to the other,different case but same place,
so what I think is to get the first image [c r] value so I can write like this
impixel(firstimage c r)
so I can get the some range about it
but I have no idea how to get c value,because c is a double(matrix…..I think)
please help me about it,thanks

Best Answer

Hi Huang,
firstimage=imread('img1.png'); %Line 1
[c r p]=impixel(firstimage); %Line 2
It is my understanding that you want to get the c and r values of firstimage and apply impixel on other image (or firstimage) for same (x, y) coordinates i.e., c and r values.
secondimage = impixel(other_image,c,r); %Line 3
In line 2, you will get numeric vectors c and r that can be used as (x,y) coordinates in other image. So, line 3 will return pixel values for the other image for same (x, y) coordinates as used in firstimage.